package co.edu.usbcali.egrapico.vista;

import co.edu.usbcali.egrapico.logica.Traslator;
import co.edu.usbcali.egrapico.modelo.GrapicoFile;
import co.edu.usbcali.egrapico.modelo.ObjectFactory;
import co.edu.usbcali.egrapico.modelo.Program;
import co.edu.usbcali.egrapico.vista.ambient.*;
import co.edu.usbcali.egrapico.vista.tools.MethodList;
import co.edu.usbcali.egrapico.vista.tools.MyIcon;
import co.edu.usbcali.egrapico.vista.tools.ObjectAtList;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;

public class FrmPrincipal extends javax.swing.JFrame {

    int contadorObjeto = 0;
    int frame_distancia;

    /**
     * Creates new form FrmPrincipal
     */
    public FrmPrincipal() {
        objetos = new java.util.Vector();
        metodos = new java.util.Vector();
        initComponents();
        jtBarraEdit.setVisible(false);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        form3 = new javax.swing.JFrame();
        Save_File = new javax.swing.JFileChooser();
        jPopupMenu1 = new javax.swing.JPopupMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jPopupMenu2 = new javax.swing.JPopupMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jtBarraPpal = new javax.swing.JToolBar();
        jtBarraFile = new javax.swing.JToolBar();
        btnNew = new javax.swing.JButton();
        btnOpen = new javax.swing.JButton();
        btnSave = new javax.swing.JButton();
        btnAmbient = new javax.swing.JButton();
        btnHome = new javax.swing.JButton();
        jtBarraPrint = new javax.swing.JToolBar();
        btnView = new javax.swing.JButton();
        btnPrint = new javax.swing.JButton();
        jtBarraRun = new javax.swing.JToolBar();
        btnParse = new javax.swing.JButton();
        btnCompile = new javax.swing.JButton();
        btnPropierties = new javax.swing.JButton();
        btnDelete = new javax.swing.JButton();
        jtBarraView = new javax.swing.JToolBar();
        btnZoomIn = new javax.swing.JButton();
        btnZoomOut = new javax.swing.JButton();
        btnShell = new javax.swing.JButton();
        btnGrid = new javax.swing.JButton();
        btnGridIn = new javax.swing.JButton();
        btnGridOut = new javax.swing.JButton();
        btnTools = new javax.swing.JButton();
        jtBarraEdit = new javax.swing.JToolBar();
        btnUndo = new javax.swing.JButton();
        btnRedo = new javax.swing.JButton();
        jSplitPane2 = new javax.swing.JSplitPane();
        jSplitPane1 = new javax.swing.JSplitPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        raiz2 = new javax.swing.tree.DefaultMutableTreeNode ("Program");
        CrearNodo2(raiz2);
        treeModel2 = new javax.swing.tree.DefaultTreeModel(raiz2);
        jTree2 =   new javax.swing.JTree(treeModel2);
        raiz3 = new javax.swing.tree.DefaultMutableTreeNode ("Restrictions");
        CrearNodo3(raiz3);
        jTree3 = new javax.swing.JTree(raiz3);
        raiz4 = new javax.swing.tree.DefaultMutableTreeNode ("Operators");
        CrearNodo4(raiz4);
        jTree4 =  new javax.swing.JTree(raiz4);
        raiz5 = new javax.swing.tree.DefaultMutableTreeNode ("Message");
        CrearNodo5(raiz5);
        treeModel5 = new javax.swing.tree.DefaultTreeModel(raiz5);
        jTree5 =  new javax.swing.JTree(treeModel5);
        raiz6 = new javax.swing.tree.DefaultMutableTreeNode ("Restrictions");
        CrearNodo6(raiz6);
        jTree6 = new javax.swing.JTree(raiz6);
        raiz7 = new javax.swing.tree.DefaultMutableTreeNode ("Restrictions");
        CrearNodo7(raiz7);
        jTree7 = new javax.swing.JTree(raiz7);
        raiz8 = new javax.swing.tree.DefaultMutableTreeNode ("Operators");
        CrearNodo8(raiz8);
        jTree8 =  new javax.swing.JTree(raiz8);
        raiz9 = new javax.swing.tree.DefaultMutableTreeNode ("Program");
        CrearNodo9(raiz9);
        treeModel9 = new javax.swing.tree.DefaultTreeModel(raiz9);
        jTree9 = new javax.swing.JTree(treeModel9);
        raiz = new javax.swing.tree.DefaultMutableTreeNode ("Process");
        CrearNodo(raiz);
        treeModel = new javax.swing.tree.DefaultTreeModel(raiz);
        jTree1 =  new javax.swing.JTree(treeModel);
        area=new java.awt.Dimension(0,0);
        Iframe = new PanelProgram();
        Iframe.setTitle("Main");
        jScrollPane3 = new javax.swing.JScrollPane();
        jdpAreaTrabajo = new javax.swing.JDesktopPane();
        jpContenedor = new javax.swing.JPanel();
        jtpPestanas = new javax.swing.JTabbedPane();
        jspGrapitextual = new javax.swing.JScrollPane();
        txtFileGraPicoT = new javax.swing.JTextArea();
        jspCalculoPico = new javax.swing.JScrollPane();
        txtTraslatePico = new javax.swing.JTextArea();
        jspAnalisisSemantico = new javax.swing.JScrollPane();
        txtmsgSemantic = new javax.swing.JTextArea();
        jspResultados = new javax.swing.JScrollPane();
        txtmsgResults = new javax.swing.JTextArea();
        lblContexto = new javax.swing.JLabel();
        jBarraMenu = new javax.swing.JMenuBar();
        mfile = new javax.swing.JMenu();
        file_new = new javax.swing.JMenuItem();
        file_open = new javax.swing.JMenuItem();
        file_save = new javax.swing.JMenuItem();
        file_save_as = new javax.swing.JMenuItem();
        file_separador1 = new javax.swing.JSeparator();
        file_printpreview = new javax.swing.JMenuItem();
        file_print = new javax.swing.JMenuItem();
        file_separador2 = new javax.swing.JSeparator();
        file_exit = new javax.swing.JMenuItem();
        mambient = new javax.swing.JMenu();
        ambient_gotomain = new javax.swing.JMenuItem();
        ambient_ambientlist = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        ambient_zoomin = new javax.swing.JMenuItem();
        ambient_zoomout = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        ambient_showgrid = new javax.swing.JMenuItem();
        ambient_aligntogrid = new javax.swing.JMenuItem();
        ambient_gridmas = new javax.swing.JMenuItem();
        ambient_gridmen = new javax.swing.JMenuItem();
        mobject = new javax.swing.JMenu();
        object_shape = new javax.swing.JMenuItem();
        objetc_remove = new javax.swing.JMenuItem();
        mbuild = new javax.swing.JMenu();
        build_parse = new javax.swing.JMenuItem();
        build_compile = new javax.swing.JMenuItem();
        mwindow = new javax.swing.JMenu();
        window_cascade = new javax.swing.JMenuItem();
        window_tileh = new javax.swing.JMenuItem();
        window_tilev = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JSeparator();
        window_hidetoolbox = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JSeparator();
        window_main = new javax.swing.JMenuItem();
        mhelp = new javax.swing.JMenu();
        help_grapico = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JSeparator();
        help_about = new javax.swing.JMenuItem();

        form3.getContentPane().add(Save_File, java.awt.BorderLayout.CENTER);

        jMenuItem1.setText("Add Object");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItem1);

        jMenuItem2.setText("Modify Object");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jPopupMenu2.add(jMenuItem2);

        jMenuItem3.setText("Remove Object");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jPopupMenu2.add(jMenuItem3);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("E_GraPiCO");
        setIconImage(getIconImage());
        setMinimumSize(new java.awt.Dimension(1000, 800));
        setName("FrmPrincipal");

        jtBarraPpal.setRollover(true);

        btnNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/New.gif"))); // NOI18N
        btnNew.setToolTipText("New Program");
        btnNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNewActionPerformed(evt);
            }
        });
        jtBarraFile.add(btnNew);

        btnOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Open.gif"))); // NOI18N
        btnOpen.setToolTipText("Open");
        btnOpen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                file_openActionPerformed(evt);
            }
        });
        jtBarraFile.add(btnOpen);

        btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Save.gif"))); // NOI18N
        btnSave.setToolTipText("Save to Disk");
        btnSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                file_saveActionPerformed(evt);
            }
        });
        jtBarraFile.add(btnSave);

        btnAmbient.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Ambient.gif"))); // NOI18N
        btnAmbient.setToolTipText("Ambient List");
        jtBarraFile.add(btnAmbient);

        btnHome.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Home.gif"))); // NOI18N
        btnHome.setToolTipText("Go to Main");
        btnHome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ambient_gotomainActionPerformed(evt);
            }
        });
        jtBarraFile.add(btnHome);

        jtBarraPpal.add(jtBarraFile);

        btnView.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/View.gif"))); // NOI18N
        btnView.setToolTipText("Ambient Preview");
        jtBarraPrint.add(btnView);

        btnPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Print.gif"))); // NOI18N
        btnPrint.setToolTipText("Print Ambient");
        jtBarraPrint.add(btnPrint);

        jtBarraPpal.add(jtBarraPrint);

        btnParse.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Parse.gif"))); // NOI18N
        btnParse.setToolTipText("Parse");
        jtBarraRun.add(btnParse);

        btnCompile.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Compile.gif"))); // NOI18N
        btnCompile.setToolTipText("Compile");
        btnCompile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                build_compileActionPerformed(evt);
            }
        });
        jtBarraRun.add(btnCompile);

        btnPropierties.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Properties.gif"))); // NOI18N
        btnPropierties.setToolTipText("Shape Properties\n");
        jtBarraRun.add(btnPropierties);

        btnDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Delete.gif"))); // NOI18N
        btnDelete.setToolTipText("Delete Shape");
        jtBarraRun.add(btnDelete);

        jtBarraPpal.add(jtBarraRun);

        btnZoomIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Zoom+.gif"))); // NOI18N
        btnZoomIn.setToolTipText("Zoom +");
        btnZoomIn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnZoomInActionPerformed(evt);
            }
        });
        jtBarraView.add(btnZoomIn);

        btnZoomOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Zoom-.gif"))); // NOI18N
        btnZoomOut.setToolTipText("Zoom -");
        jtBarraView.add(btnZoomOut);

        btnShell.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Shell_43.gif"))); // NOI18N
        btnShell.setToolTipText("Hide ToolBox");
        jtBarraView.add(btnShell);

        btnGrid.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Grid1.gif"))); // NOI18N
        btnGrid.setToolTipText("Align to Grid");
        jtBarraView.add(btnGrid);

        btnGridIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Grif+.gif"))); // NOI18N
        btnGridIn.setToolTipText("Grid +");
        jtBarraView.add(btnGridIn);

        btnGridOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Grif-.gif"))); // NOI18N
        btnGridOut.setToolTipText("Grid -");
        jtBarraView.add(btnGridOut);

        btnTools.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Tools.gif"))); // NOI18N
        btnTools.setToolTipText("Hide ToolBox");
        jtBarraView.add(btnTools);

        jtBarraPpal.add(jtBarraView);

        btnUndo.setText("Undo");
        btnUndo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUndoActionPerformed(evt);
            }
        });
        jtBarraEdit.add(btnUndo);

        btnRedo.setText("Redo");
        btnRedo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRedoActionPerformed(evt);
            }
        });
        jtBarraEdit.add(btnRedo);

        jtBarraPpal.add(jtBarraEdit);

        getContentPane().add(jtBarraPpal, java.awt.BorderLayout.PAGE_START);

        jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        jSplitPane2.setPreferredSize(new java.awt.Dimension(217, 560));

        jSplitPane1.setMinimumSize(new java.awt.Dimension(759, 431));
        jSplitPane1.setPreferredSize(new java.awt.Dimension(525, 471));

        jScrollPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jScrollPane1.setViewportBorder(javax.swing.BorderFactory.createEtchedBorder());
        jScrollPane1.setAutoscrolls(true);
        jScrollPane1.setMinimumSize(new java.awt.Dimension(89, 209));
        jScrollPane1.setPreferredSize(new java.awt.Dimension(150, 428));

        jTree2.setAutoscrolls(true);
        jTree2.setCellRenderer(new MirendererTree2());
        jTree2.setDragEnabled(true);
        jTree2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTree2MouseClicked(evt);
            }
        });
        jTree2.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree2MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree2);

        jTree3.setCellRenderer(new MirendererTree3());
        jTree3.setDragEnabled(true);
        jTree3.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
            public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
                jTree3ValueChanged(evt);
            }
        });
        jTree3.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree3MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree3);

        jTree4.setCellRenderer(new MirendererTree4());
        jTree4.setDragEnabled(true);
        jTree4.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
            public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
                jTree4ValueChanged(evt);
            }
        });
        jTree4.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree4MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree4);

        jTree5.setCellRenderer(new MirendererTree5());
        jTree5.setDragEnabled(true);
        jTree5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTree5MouseClicked(evt);
            }
        });
        jTree5.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree5MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree5);

        jTree6.setCellRenderer(new MirendererTree6());
        jTree6.setDragEnabled(true);
        jTree6.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree6MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree6);

        jTree7.setCellRenderer(new MirendererTree7());
        jTree7.setDragEnabled(true);
        jTree7.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree7MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree7);

        jTree8.setCellRenderer(new MirendererTree8());
        jTree8.setDragEnabled(true);
        jTree8.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree8MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree8);

        jTree9.setCellRenderer(new MirendererTree9());
        jTree9.setDragEnabled(true);
        jTree9.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree9MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree9);

        jTree1.setCellRenderer(new MirendererTree());
        jTree1.setDragEnabled(true);
        jTree1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTree1MouseClicked(evt);
            }
        });
        jTree1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jTree1MouseMoved(evt);
            }
        });
        jScrollPane1.setViewportView(jTree1);

        jSplitPane1.setLeftComponent(jScrollPane1);

        jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jdpAreaTrabajo.setBackground(new java.awt.Color(0, 102, 153));
        jdpAreaTrabajo.setDesktopManager(new MyDesktopManager());
        jdpAreaTrabajo.setPreferredSize(new java.awt.Dimension(400, 450));
        jdpAreaTrabajo.add(Iframe);
        jScrollPane3.setViewportView(jdpAreaTrabajo);

        jSplitPane1.setRightComponent(jScrollPane3);

        jSplitPane2.setTopComponent(jSplitPane1);

        jpContenedor.setLayout(new java.awt.BorderLayout());

        txtFileGraPicoT.setColumns(20);
        txtFileGraPicoT.setRows(5);
        jspGrapitextual.setViewportView(txtFileGraPicoT);

        jtpPestanas.addTab("Textual GraPiCO", jspGrapitextual);

        txtTraslatePico.setColumns(20);
        txtTraslatePico.setRows(5);
        jspCalculoPico.setViewportView(txtTraslatePico);

        jtpPestanas.addTab("PiCO Calculus", jspCalculoPico);

        txtmsgSemantic.setColumns(20);
        txtmsgSemantic.setRows(5);
        jspAnalisisSemantico.setViewportView(txtmsgSemantic);

        jtpPestanas.addTab("Semantic Analysis", jspAnalisisSemantico);

        txtmsgResults.setColumns(20);
        txtmsgResults.setRows(5);
        jspResultados.setViewportView(txtmsgResults);

        jtpPestanas.addTab("Variable Results", jspResultados);

        jpContenedor.add(jtpPestanas, java.awt.BorderLayout.CENTER);

        lblContexto.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblContexto.setText("Contexto");
        jpContenedor.add(lblContexto, java.awt.BorderLayout.SOUTH);

        jSplitPane2.setBottomComponent(jpContenedor);

        getContentPane().add(jSplitPane2, java.awt.BorderLayout.CENTER);

        jBarraMenu.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jBarraMenuPropertyChange(evt);
            }
        });

        mfile.setText("File");

        file_new.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/New.gif"))); // NOI18N
        file_new.setText("New");
        file_new.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNewActionPerformed(evt);
            }
        });
        mfile.add(file_new);

        file_open.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Open.gif"))); // NOI18N
        file_open.setText("Open...");
        file_open.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                file_openActionPerformed(evt);
            }
        });
        mfile.add(file_open);

        file_save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Save.gif"))); // NOI18N
        file_save.setText("Save");
        file_save.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                file_saveActionPerformed(evt);
            }
        });
        mfile.add(file_save);

        file_save_as.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Save1.gif"))); // NOI18N
        file_save_as.setText("Save As");
        file_save_as.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                file_save_asActionPerformed(evt);
            }
        });
        mfile.add(file_save_as);
        mfile.add(file_separador1);

        file_printpreview.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/View.gif"))); // NOI18N
        file_printpreview.setText("Print Preview");
        mfile.add(file_printpreview);

        file_print.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Print.gif"))); // NOI18N
        file_print.setText("Print...");
        mfile.add(file_print);
        mfile.add(file_separador2);

        file_exit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/system-exit.png"))); // NOI18N
        file_exit.setText("Exit");
        file_exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                file_exitActionPerformed(evt);
            }
        });
        mfile.add(file_exit);

        jBarraMenu.add(mfile);

        mambient.setText("Ambient");

        ambient_gotomain.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Home.gif"))); // NOI18N
        ambient_gotomain.setText("Go to Main");
        ambient_gotomain.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ambient_gotomainActionPerformed(evt);
            }
        });
        mambient.add(ambient_gotomain);

        ambient_ambientlist.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Ambient.gif"))); // NOI18N
        ambient_ambientlist.setText("Ambient List");
        mambient.add(ambient_ambientlist);
        mambient.add(jSeparator1);

        ambient_zoomin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Zoom+.gif"))); // NOI18N
        ambient_zoomin.setText("Zoom In (+)");
        mambient.add(ambient_zoomin);

        ambient_zoomout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Zoom-.gif"))); // NOI18N
        ambient_zoomout.setText("Zoom Out (-)");
        mambient.add(ambient_zoomout);
        mambient.add(jSeparator2);

        ambient_showgrid.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Grid.gif"))); // NOI18N
        ambient_showgrid.setText("Show Grid");
        mambient.add(ambient_showgrid);

        ambient_aligntogrid.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Grid1.gif"))); // NOI18N
        ambient_aligntogrid.setText("Align to Grid");
        mambient.add(ambient_aligntogrid);

        ambient_gridmas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Grif+.gif"))); // NOI18N
        ambient_gridmas.setText("Grid Size (+)");
        mambient.add(ambient_gridmas);

        ambient_gridmen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Grif-.gif"))); // NOI18N
        ambient_gridmen.setText("Grid Size (-)");
        mambient.add(ambient_gridmen);

        jBarraMenu.add(mambient);

        mobject.setText("Object");

        object_shape.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Properties.gif"))); // NOI18N
        object_shape.setText("Shape Properties");
        mobject.add(object_shape);

        objetc_remove.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Delete.gif"))); // NOI18N
        objetc_remove.setText("Remove Shape");
        mobject.add(objetc_remove);

        jBarraMenu.add(mobject);

        mbuild.setText("Build");

        build_parse.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Parse.gif"))); // NOI18N
        build_parse.setText("Parse");
        mbuild.add(build_parse);

        build_compile.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Compile.gif"))); // NOI18N
        build_compile.setText("Compile");
        build_compile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                build_compileActionPerformed(evt);
            }
        });
        mbuild.add(build_compile);

        jBarraMenu.add(mbuild);

        mwindow.setText("Window");

        window_cascade.setText("Cascade");
        window_cascade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                window_cascadeActionPerformed(evt);
            }
        });
        mwindow.add(window_cascade);

        window_tileh.setText("Tile Horizontally");
        window_tileh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                window_tilehActionPerformed(evt);
            }
        });
        mwindow.add(window_tileh);

        window_tilev.setText("Tile Vertically");
        window_tilev.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                window_tilevActionPerformed(evt);
            }
        });
        mwindow.add(window_tilev);
        mwindow.add(jSeparator3);

        window_hidetoolbox.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/Tools.gif"))); // NOI18N
        window_hidetoolbox.setText("Hide ToolBox");
        mwindow.add(window_hidetoolbox);
        mwindow.add(jSeparator4);

        window_main.setText("(aqui va el main)");
        mwindow.add(window_main);

        jBarraMenu.add(mwindow);

        mhelp.setText("Help");

        help_grapico.setText("GraPiCO Help");
        mhelp.add(help_grapico);
        mhelp.add(jSeparator5);

        help_about.setText("About");
        mhelp.add(help_about);

        jBarraMenu.add(mhelp);

        setJMenuBar(jBarraMenu);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        javax.swing.tree.DefaultMutableTreeNode nodoseleccionado = (javax.swing.tree.DefaultMutableTreeNode) ((javax.swing.JTree) jScrollPane1.getViewport().getView()).getLastSelectedPathComponent();
        for (int i = 0; i < objetos.size(); i++) {
            if (((ObjectAtList) objetos.get(i)).getID().equals(nodoseleccionado.toString())) {
                //borrado de todos los objetos en los frames 
                for (int j = 0; j < jdpAreaTrabajo.getComponentCount(); j++) {
                    if (jdpAreaTrabajo.getComponent(j) instanceof PanelProgram) {
                        for (int k = 0; k < ((PanelProgram) jdpAreaTrabajo.getComponent(j)).getLPane().getComponentCount(); k++) {
                            if (((PanelProgram) jdpAreaTrabajo.getComponent(j)).getLPane().getComponent(k) instanceof LabelObject) {
                                if (((LabelObject) ((PanelProgram) jdpAreaTrabajo.getComponent(j)).getLPane().getComponent(k)).getName().equals(nodoseleccionado.toString())) {
                                    ((LabelObject) ((PanelProgram) jdpAreaTrabajo.getComponent(j)).getLPane().getComponent(k)).remover();
                                }
                            }
                        }
                    }
                }
                //borrado de todos los metodos 
                for (int m = 0; m < ((ObjectAtList) objetos.get(i)).getMethodCount(); m++) {
                    for (int j = 0; j < jdpAreaTrabajo.getComponentCount(); j++) {
                        if (jdpAreaTrabajo.getComponent(j) instanceof PanelContext) {
                            for (int k = 0; k < ((PanelContext) jdpAreaTrabajo.getComponent(j)).getLPane().getComponentCount(); k++) {
                                if (((PanelContext) jdpAreaTrabajo.getComponent(j)).getLPane().getComponent(k) instanceof LabelMethod) {
                                    if (((LabelMethod) ((PanelContext) jdpAreaTrabajo.getComponent(j)).getLPane().getComponent(k)).getName().equals(((ObjectAtList) objetos.get(i)).getMethod(m).getID())) {
                                        ((LabelMethod) ((PanelContext) jdpAreaTrabajo.getComponent(j)).getLPane().getComponent(k)).remover();
                                    }
                                }
                            }
                        } else if (jdpAreaTrabajo.getComponent(j) instanceof PanelPrecedentMsg) {
                            if (((PanelPrecedentMsg) jdpAreaTrabajo.getComponent(j)).getMethodObject().getName().equals(((ObjectAtList) objetos.get(i)).getMethod(m).getID())) {
                                ((PanelPrecedentMsg) jdpAreaTrabajo.getComponent(j)).getMethodObject().remover();
                            }


                        }
                    }
                    metodos.remove(((ObjectAtList) objetos.get(i)).getMethod(m).getID());
                }
                //borrado del arbol
                objetos.removeElementAt(i);
                AptualizarObjeto();
                jTree1.scrollPathToVisible(new TreePath(parentNode.getFirstLeaf().getPath()));
                break;
            }
        }
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void file_save_asActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_file_save_asActionPerformed

        int opcion = Save_File.showSaveDialog(this);
        int u;
        while (Save_File.getSelectedFile().exists() && opcion == JFileChooser.APPROVE_OPTION) {
            u = javax.swing.JOptionPane.showConfirmDialog(Save_File, "The File exist ..�do you wish overWrite?", "Option Save File", javax.swing.JOptionPane.WARNING_MESSAGE);
            if (u == 0) {
                break;
            } else {
                opcion = Save_File.showSaveDialog(this);
            }
        }
        if (opcion == JFileChooser.APPROVE_OPTION && Save_File.getSelectedFile().getName().contains(".xml")) {
            try {

                GrapicoFile root = new ObjectFactory().createGrapicoFile();

                // cargar los objetos en el programa
                for (int i = 0; i < objetos.size(); i++) {
                    root.getObjectDef().add(MakeObject((ObjectAtList) objetos.get(i)));
                }
                //ahora cargamos el programa 
                Program pro = MakeProgram(Iframe);
                root.setProgram(pro);

                java.io.FileOutputStream fosFrame = new java.io.FileOutputStream(Save_File.getSelectedFile().getPath());
                javax.xml.bind.Marshaller marshaller = javax.xml.bind.JAXBContext.newInstance("org.netbeans.xml.schema.schemagrapico").createMarshaller();
                marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

                marshaller.marshal(root, (java.io.OutputStream) (fosFrame));

            } catch (Exception e) {
                lblContexto.setText(e.toString());
            }
            lblContexto.setText("Saved " + Save_File.getSelectedFile().getName());

        } else {
            lblContexto.setText("Not saved");
        }
    }//GEN-LAST:event_file_save_asActionPerformed

    private void window_tilehActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_window_tilehActionPerformed
// TODO add your handling code here:
        JInternalFrame[] frames = jdpAreaTrabajo.getAllFrames();

        int framescontador = 0;

        for (int i = 0; i < frames.length; i++) {
            if (frames[i].isVisible()) {
                framescontador++;
            }
        }

        int cols = (int) Math.sqrt(framescontador);
        int rows = framescontador / cols;
        int extra = framescontador % cols;

        int ancho = jdpAreaTrabajo.getWidth() / cols;
        int altura = jdpAreaTrabajo.getHeight() / rows;
        int r = 0;
        int c = 0;

        for (int i = 0; i < frames.length; i++) {

            try {
                if (frames[i].isVisible()) {
                    frames[i].setMaximum(false);
                    frames[i].reshape(c * ancho, r * altura, ancho, altura);
                    r++;
                    if (r == rows) {
                        r = 0;
                        c++;
                        if (c == cols - extra) {
                            rows++;
                            altura = jdpAreaTrabajo.getHeight() / rows;
                        }
                    }
                }
            } catch (java.beans.PropertyVetoException e) {
            }
        }
    }//GEN-LAST:event_window_tilehActionPerformed

    private void window_tilevActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_window_tilevActionPerformed

        JInternalFrame[] frames = jdpAreaTrabajo.getAllFrames();

        int frameCount = 0;
        for (int i = 0; i < frames.length; i++) {
            if (frames[i].isVisible()) {
                frameCount++;
            }
        }

        int rows = (int) Math.sqrt(frameCount);
        int cols = frameCount / rows;
        int extra = frameCount % rows;

        int ancho = jdpAreaTrabajo.getWidth() / cols;
        int altura = jdpAreaTrabajo.getHeight() / rows;
        int r = 0;
        int c = 0;

        for (int i = 0; i < frames.length; i++) {
            if (!frames[i].isIcon()) {
                try {
                    if (frames[i].isVisible()) {
                        frames[i].setMaximum(false);
                        frames[i].reshape(c * ancho, r * altura, ancho, altura);
                        r++;
                        if (r == rows) {
                            r = 0;
                            c++;
                            if (c == cols - extra) { // start adding an extra row
                                rows++;
                                altura = jdpAreaTrabajo.getHeight() / rows;
                            }
                        }
                    }
                } catch (java.beans.PropertyVetoException e) {
                }
            }
        }
    }//GEN-LAST:event_window_tilevActionPerformed

    private void window_cascadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_window_cascadeActionPerformed
        int x = 0, y = 0;
        int ancho, altura;

        JInternalFrame[] frames = jdpAreaTrabajo.getAllFrames();
        ancho = jdpAreaTrabajo.getWidth() / 2;
        altura = jdpAreaTrabajo.getHeight() / 2;

        for (int i = 0; i < frames.length; i++) {
            try {
                if (frames[i].isVisible()) {
                    frames[i].setMaximum(false);
                    frames[i].reshape(x, y, ancho, altura);
                    x = x + frame_distancia;
                    y = y + frame_distancia;
                    if (x + ancho > jdpAreaTrabajo.getWidth()) {
                        x = 0;
                    }
                    if (y + altura > jdpAreaTrabajo.getHeight()) {
                        y = 0;
                    }
                }
            } catch (java.beans.PropertyVetoException e) {
            }
        }
    }//GEN-LAST:event_window_cascadeActionPerformed

    private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewActionPerformed
// TODO add your handling code here:
        jdpAreaTrabajo.removeAll();
        jdpAreaTrabajo.repaint();
        Iframe = new PanelProgram();
        Iframe.setTitle("Main");
        jdpAreaTrabajo.add(Iframe);
        objetos = new java.util.Vector();
        metodos = new java.util.Vector();
        AptualizarObjeto();
        jScrollPane1.setViewportView(jTree1);
        txtFileGraPicoT.setText("");
        txtTraslatePico.setText("");
        txtmsgSemantic.setText("");

    }//GEN-LAST:event_btnNewActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
// TODO add your handling code here:
        javax.swing.tree.DefaultMutableTreeNode nodoseleccionado = (javax.swing.tree.DefaultMutableTreeNode) ((javax.swing.JTree) jScrollPane1.getViewport().getView()).getLastSelectedPathComponent();
        FrmPrincipal.getObjeto(nodoseleccionado.toString()).mostrarPropertiesFrame();
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
// Adicionar elemento Objecto:
        obj = new ObjectAtList("Object" + String.valueOf(objetos.size() + 1));
        obj.mostrarPropertiesFrame();
    }//GEN-LAST:event_jMenuItem1ActionPerformed
    public static void Addobj(String s) {
        obj.setID(s);
        adicionarObjeto(obj);
    }

    public static void adicionarObjeto(ObjectAtList bjct) {
        AddObjeto(bjct);
        javax.swing.tree.DefaultMutableTreeNode objeto1 = new javax.swing.tree.DefaultMutableTreeNode(bjct.getID());
        javax.swing.tree.DefaultMutableTreeNode objeto2 = new javax.swing.tree.DefaultMutableTreeNode(bjct.getID());
        javax.swing.tree.DefaultMutableTreeNode objeto5 = new javax.swing.tree.DefaultMutableTreeNode(bjct.getID());

        treeModel.insertNodeInto(objeto1, parentNode, parentNode.getChildCount());
        jTree1.scrollPathToVisible(new TreePath(objeto1.getPath()));
        treeModel2.insertNodeInto(objeto2, parentNode2, parentNode2.getChildCount());
        jTree2.scrollPathToVisible(new TreePath(objeto2.getPath()));
        treeModel5.insertNodeInto(objeto5, parentNode5, parentNode5.getChildCount());
        jTree5.scrollPathToVisible(new TreePath(objeto5.getPath()));

        for (int i = 0; i < bjct.getMethodCount(); i++) {
            AddMethod(bjct.getMethod(i).getID());
            javax.swing.tree.DefaultMutableTreeNode metodo = new javax.swing.tree.DefaultMutableTreeNode(bjct.getMethod(i).getID());
            javax.swing.tree.DefaultMutableTreeNode metodo2 = new javax.swing.tree.DefaultMutableTreeNode(bjct.getMethod(i).getID());
            treeModel5.insertNodeInto(metodo, objeto5, objeto5.getChildCount());
            treeModel2.insertNodeInto(metodo2, objeto2, objeto2.getChildCount());
        }
    }

    public static void AptualizarObjeto() {
        javax.swing.tree.DefaultMutableTreeNode objeto1, objeto2, objeto5;
        parentNode.removeAllChildren();
        treeModel.reload();
        parentNode2.removeAllChildren();
        treeModel2.reload();
        parentNode5.removeAllChildren();
        treeModel5.reload();
        metodos.removeAllElements();
        for (int i = 0; i < objetos.size(); i++) {
            objeto1 = new javax.swing.tree.DefaultMutableTreeNode(((ObjectAtList) objetos.get(i)).getID());
            treeModel.insertNodeInto(objeto1, parentNode, parentNode.getChildCount());
            jTree1.scrollPathToVisible(new TreePath(objeto1.getPath()));
            objeto2 = new javax.swing.tree.DefaultMutableTreeNode(((ObjectAtList) objetos.get(i)).getID());
            treeModel2.insertNodeInto(objeto2, parentNode2, parentNode2.getChildCount());
            jTree2.scrollPathToVisible(new TreePath(objeto2.getPath()));
            objeto5 = new javax.swing.tree.DefaultMutableTreeNode(((ObjectAtList) objetos.get(i)).getID());
            treeModel5.insertNodeInto(objeto5, parentNode5, parentNode5.getChildCount());
            jTree5.scrollPathToVisible(new TreePath(objeto5.getPath()));
            for (int j = 0; j < ((ObjectAtList) objetos.get(i)).getMethodCount(); j++) {
                AddMethod(((ObjectAtList) objetos.get(i)).getMethod(j).getID());
                javax.swing.tree.DefaultMutableTreeNode metodo = new javax.swing.tree.DefaultMutableTreeNode(((ObjectAtList) objetos.get(i)).getMethod(j).getID());
                javax.swing.tree.DefaultMutableTreeNode metodo2 = new javax.swing.tree.DefaultMutableTreeNode(((ObjectAtList) objetos.get(i)).getMethod(j).getID());
                treeModel5.insertNodeInto(metodo, objeto5, objeto5.getChildCount());
                jTree5.scrollPathToVisible(new TreePath(metodo.getPath()));
                treeModel2.insertNodeInto(metodo2, objeto2, objeto2.getChildCount());
                jTree2.scrollPathToVisible(new TreePath(objeto2.getPath()));
            }
        }
    }
    private void jTree5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree5MouseClicked
// TODO add your handling code here:
        if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) {
            javax.swing.tree.DefaultMutableTreeNode nodoseleccionado = (javax.swing.tree.DefaultMutableTreeNode) jTree5.getLastSelectedPathComponent();
            if (nodoseleccionado != null) {
                if (nodoseleccionado.toString().equals("Objects")) {
                    jPopupMenu1.show(evt.getComponent(), evt.getX(), evt.getY());
                } else if (nodoseleccionado.getParent().toString().equals("Objects")) {
                    jPopupMenu2.show(evt.getComponent(), evt.getX(), evt.getY());
                }
            }
        }
    }//GEN-LAST:event_jTree5MouseClicked

    private void jTree1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree1MouseClicked
// TODO add your handling code here:
        if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) {

            javax.swing.tree.DefaultMutableTreeNode nodoseleccionado = (javax.swing.tree.DefaultMutableTreeNode) jTree1.getLastSelectedPathComponent();
            if (nodoseleccionado != null) {
                if (nodoseleccionado.toString().equals("Objects")) {
                    jPopupMenu1.show(evt.getComponent(), evt.getX(), evt.getY());
                } else if (nodoseleccionado.getParent().toString().equals("Objects")) {
                    jPopupMenu2.show(evt.getComponent(), evt.getX(), evt.getY());
                }
            }
        }
    }//GEN-LAST:event_jTree1MouseClicked

    private void jTree2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree2MouseClicked
// TODO add your handling code here:
        if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) {
            javax.swing.tree.DefaultMutableTreeNode nodoseleccionado = (javax.swing.tree.DefaultMutableTreeNode) jTree2.getLastSelectedPathComponent();
            if (nodoseleccionado != null) {
                if (nodoseleccionado.toString().equals("Objects")) {
                    jPopupMenu1.show(evt.getComponent(), evt.getX(), evt.getY());
                } else if (nodoseleccionado.getParent().toString().equals("Objects")) {
                    jPopupMenu2.show(evt.getComponent(), evt.getX(), evt.getY());
                }
            }
        }
    }//GEN-LAST:event_jTree2MouseClicked

    private void ambient_gotomainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ambient_gotomainActionPerformed
// TODO add your handling code here:
        Iframe.setVisible(true);
        try {
            Iframe.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {
        }
    }//GEN-LAST:event_ambient_gotomainActionPerformed

    private void jBarraMenuPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jBarraMenuPropertyChange
// TODO add your handling code here:
        mfile.setMnemonic(java.awt.event.KeyEvent.VK_F);
        file_new.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.ActionEvent.CTRL_MASK));
        file_open.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.ActionEvent.CTRL_MASK));
        file_save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.ActionEvent.CTRL_MASK));
        file_print.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.ActionEvent.CTRL_MASK));

        mambient.setMnemonic(java.awt.event.KeyEvent.VK_A);
        mobject.setMnemonic(java.awt.event.KeyEvent.VK_O);
        mbuild.setMnemonic(java.awt.event.KeyEvent.VK_B);
        build_compile.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F9, java.awt.event.ActionEvent.CTRL_MASK));
        mwindow.setMnemonic(java.awt.event.KeyEvent.VK_W);
        mhelp.setMnemonic(java.awt.event.KeyEvent.VK_H);
    }//GEN-LAST:event_jBarraMenuPropertyChange

    private void file_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_file_saveActionPerformed

        int opcion = 0;

        try {
            String k = Save_File.getSelectedFile().getName();
            if (!Save_File.getSelectedFile().getName().contains(".xml")) {
                opcion = Save_File.showSaveDialog(this);
            }
        } catch (java.lang.NullPointerException e) {

            opcion = Save_File.showSaveDialog(this);
            int u;
            while (Save_File.getSelectedFile().exists() && opcion == JFileChooser.APPROVE_OPTION) {

                u = javax.swing.JOptionPane.showConfirmDialog(Save_File, "The File exist ..�do you wish overWrite?", "Option Save File", javax.swing.JOptionPane.WARNING_MESSAGE);
                if (u == 0) {
                    break;
                } else {
                    opcion = Save_File.showSaveDialog(this);
                }
            }

        }
        if (opcion == JFileChooser.APPROVE_OPTION && Save_File.getSelectedFile().getName().contains(".xml")) {
            try {
                GrapicoFile root = new ObjectFactory().createGrapicoFile();

                // cargar los objetos en el programa
                for (int i = 0; i < objetos.size(); i++) {
                    root.getObjectDef().add(MakeObject((ObjectAtList) objetos.get(i)));
                }
                //ahora cargamos el programa 
                Program pro = MakeProgram(Iframe);
                root.setProgram(pro);

                java.io.FileOutputStream fosFrame = new java.io.FileOutputStream(Save_File.getSelectedFile().getPath());
                javax.xml.bind.Marshaller marshaller = javax.xml.bind.JAXBContext.newInstance("org.netbeans.xml.schema.schemagrapico").createMarshaller();
                marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

                marshaller.marshal(root, (java.io.OutputStream) (fosFrame));

            } catch (Exception e) {
                lblContexto.setText(e.toString());
            }
            lblContexto.setText("Saved " + Save_File.getSelectedFile().getName());

        } else {
            lblContexto.setText("Not saved");
        }
    }//GEN-LAST:event_file_saveActionPerformed
    public co.edu.usbcali.egrapico.modelo.Object MakeObject(ObjectAtList o) {
        co.edu.usbcali.egrapico.modelo.Object ob = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createObject();
        int j;
        ob.setName(o.getID());
        for (j = 0; j < o.getFrame().getForward().getFrame().getLPane().getComponentCount(); j++) {
            co.edu.usbcali.egrapico.modelo.Object.ForwardRestriction of = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createObjectForwardRestriction();
            co.edu.usbcali.egrapico.modelo.PhysicPart pff = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();
            pff.setPosX(o.getFrame().getForward().getFrame().getLPane().getComponent(j).getX());
            pff.setPosY(o.getFrame().getForward().getFrame().getLPane().getComponent(j).getY());
            pff.setImage("forwardRestriction.gif");
            pff.setLabel(o.getFrame().getForward().getFrame().getLPane().getComponent(j).getName());
            pff.setComment(((LabelRestrictionF) o.getFrame().getForward().getFrame().getLPane().getComponent(j)).getTextPane());
            of.setPhysicPart(pff);
            LPaneRestrictionF lp = ((LabelRestrictionF) o.getFrame().getForward().getFrame().getLPane().getComponent(j)).getFrame().getLPane();
            lp.ApIcons(null);
            for (int k = 0; k < lp.getComponentCount(); k++) {
                if (lp.getComponent(k) instanceof LabelIdeOpe) {
                    of.getIdentifier().add(MakeIdentifier((LabelIdeOpe) lp.getComponent(k)));
                }
            }
            ob.getForwardRestriction().add(of);
        }
        for (j = 0; j < o.getFrame().getSender().getFrame().getLPane().getComponentCount(); j++) {
            co.edu.usbcali.egrapico.modelo.Object.SenderRestriction os = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createObjectSenderRestriction();
            co.edu.usbcali.egrapico.modelo.PhysicPart pff = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();
            pff.setPosX(o.getFrame().getSender().getFrame().getLPane().getComponent(j).getX());
            pff.setPosY(o.getFrame().getSender().getFrame().getLPane().getComponent(j).getY());
            pff.setImage("senderRestriction.gif");
            pff.setLabel(o.getFrame().getSender().getFrame().getLPane().getComponent(j).getName());
            pff.setComment(((LabelRestriction) o.getFrame().getSender().getFrame().getLPane().getComponent(j)).getTextPane());
            os.setPhysicPart(pff);
            LPaneRestriction lp = ((LabelRestriction) o.getFrame().getSender().getFrame().getLPane().getComponent(j)).getFrame().getLPane();
            for (int k = 0; k < lp.getComponentCount(); k++) {
                if (lp.getComponent(k) instanceof LabelIdeOpe) {
                    os.getIdentifier().add(MakeIdentifier((LabelIdeOpe) lp.getComponent(k)));
                }
            }
            ob.getSenderRestriction().add(os);
        }
        for (j = 0; j < o.getFrame().getMethodCountL(); j++) {
            co.edu.usbcali.egrapico.modelo.Object.Method om = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createObjectMethod();
            om.setName(o.getFrame().getMethodL(j).getID());
            for (int k = 0; k < o.getFrame().getMethodL(j).getFrame().getLPane().getComponentCount(); k++) {
                if (o.getFrame().getMethodL(j).getFrame().getLPane().getComponent(k) instanceof LabelIdeOpe) {
                    om.getParameter().add(MakeIdentifier((LabelIdeOpe) o.getFrame().getMethodL(j).getFrame().getLPane().getComponent(k)));
                } else {
                    om.setProgram(MakeProgram((LabelProgram) o.getFrame().getMethodL(j).getFrame().getLPane().getComponent(k)));
                }
            }
            ob.getMethod().add(om);
        }
        return ob;
    }

    public co.edu.usbcali.egrapico.modelo.Program MakeProgram(PanelProgram prgm) {
        co.edu.usbcali.egrapico.modelo.Program pro = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createProgram();
        co.edu.usbcali.egrapico.modelo.PhysicPart pf = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

        pf.setPosX(prgm.getX());
        pf.setPosY(prgm.getY());
        pf.setImage("program.gif");
        pf.setLabel(prgm.getTitle());
        pf.setComment("Principal Program -root from GrapicoFile-");
        pro.setPhisicProgram(pf);

        for (int i = 0; i < prgm.getLPane().getComponentCount(); i++) {
            if (prgm.getLPane().getComponent(i) instanceof LabelContext) {
                co.edu.usbcali.egrapico.modelo.Program.Context context = new co.edu.usbcali.egrapico.modelo.Program.Context();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getLPane().getComponent(i).getY());
                if (((LabelContext) prgm.getLPane().getComponent(i)).isClon()) {
                    context.setIsclon(true);
                    pf1.setImage("cloncontex.gif");
                } else {
                    context.setIsclon(false);
                    pf1.setImage("context.gif");
                }
                pf1.setLabel(prgm.getLPane().getComponent(i).getName());
                pf1.setComment(((LabelContext) prgm.getLPane().getComponent(i)).getTextPane());
                context.setPhysicPart(pf1);
                for (int j = 0; j < ((LabelContext) prgm.getLPane().getComponent(i)).getFrame().getLPane().getComponentCount(); j++) {
                    if (((LabelContext) prgm.getLPane().getComponent(i)).getFrame().getLPane().getComponent(j) instanceof LabelIdeOpe) {
                        context.getIdentifier().add(MakeIdentifier((LabelIdeOpe) ((LabelContext) prgm.getLPane().getComponent(i)).getFrame().getLPane().getComponent(j)));
                    } else if (((LabelContext) prgm.getLPane().getComponent(i)).getFrame().getLPane().getComponent(j) instanceof LabelMethod) {
                        context.getMethodLabel().add(MakeLabelMethod((LabelMethod) ((LabelContext) prgm.getLPane().getComponent(i)).getFrame().getLPane().getComponent(j)));
                    } else if (((LabelContext) prgm.getLPane().getComponent(i)).getFrame().getLPane().getComponent(j) instanceof LabelProgram) {
                        context.setProgram(MakeProgram((LabelProgram) ((LabelContext) prgm.getLPane().getComponent(i)).getFrame().getLPane().getComponent(j)));
                    }
                }
                pro.getContext().add(context);
            } else if (prgm.getLPane().getComponent(i) instanceof LabelObject) {
                co.edu.usbcali.egrapico.modelo.Program.ObjectLabel obje = new co.edu.usbcali.egrapico.modelo.Program.ObjectLabel();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getLPane().getComponent(i).getY());
                if (((LabelObject) prgm.getLPane().getComponent(i)).isClon()) {
                    obje.setIsclon(true);
                    pf1.setImage("clon_object.gif");
                } else {
                    obje.setIsclon(false);
                    pf1.setImage("object.gif");
                }
                pf1.setLabel(prgm.getLPane().getComponent(i).getName());
                pf1.setComment(((LabelObject) prgm.getLPane().getComponent(i)).getTextPane());
                obje.setPhysicPart(pf1);
                pro.getObjectLabel().add(obje);
            } else if (prgm.getLPane().getComponent(i) instanceof LabelAsk) {
                co.edu.usbcali.egrapico.modelo.Program.Ask ask = new co.edu.usbcali.egrapico.modelo.Program.Ask();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getLPane().getComponent(i).getY());
                if (((LabelAsk) prgm.getLPane().getComponent(i)).isClon() && ((LabelAsk) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    ask.setIsclon(true);
                    ask.setHaveConsecuent(true);
                    pf1.setImage("clonask.gif");
                } else if (!((LabelAsk) prgm.getLPane().getComponent(i)).isClon() && ((LabelAsk) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    ask.setIsclon(false);
                    ask.setHaveConsecuent(true);
                    pf1.setImage("ask.gif");
                } else if (((LabelAsk) prgm.getLPane().getComponent(i)).isClon() && !((LabelAsk) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    ask.setIsclon(true);
                    ask.setHaveConsecuent(false);
                    pf1.setImage("clon_ask1.gif");
                } else if (!((LabelAsk) prgm.getLPane().getComponent(i)).isClon() && !((LabelAsk) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    ask.setIsclon(false);
                    ask.setHaveConsecuent(false);
                    pf1.setImage("askPreceding.gif");
                }
                pf1.setLabel(prgm.getLPane().getComponent(i).getName());
                pf1.setComment(((LabelAsk) prgm.getLPane().getComponent(i)).getTextPane());
                ask.setPhysicPart(pf1);
                LPanePrecedent askAux = ((LabelAsk) prgm.getLPane().getComponent(i)).getFrame().getprecedentL().getFrame().getLPane();
                for (int j = 0; j < askAux.getComponentCount(); j++) {
                    co.edu.usbcali.egrapico.modelo.Program.Ask.RestrictionAsk rask = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createProgramAskRestrictionAsk();
                    co.edu.usbcali.egrapico.modelo.PhysicPart pff = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();
                    pff.setPosX(askAux.getComponent(j).getX());
                    pff.setPosY(askAux.getComponent(j).getY());
                    pff.setImage("genericRestriction.gif");
                    pff.setLabel(askAux.getComponent(j).getName());
                    pff.setComment(((LabelRestriction) askAux.getComponent(j)).getTextPane());
                    rask.setPhysicPart(pff);
                    LPaneRestriction resAux = ((LabelRestriction) askAux.getComponent(j)).getFrame().getLPane();
                    for (int k = 0; k < resAux.getComponentCount(); k++) {
                        if (resAux.getComponent(k) instanceof LabelIdeOpe) {
                            rask.getIdentifier().add(MakeIdentifier((LabelIdeOpe) resAux.getComponent(k)));
                        }
                    }
                    ask.getRestrictionAsk().add(rask);
                }
                pro.getAsk().add(ask);

            } else if (prgm.getLPane().getComponent(i) instanceof LabelTell) {
                co.edu.usbcali.egrapico.modelo.Program.Tell tell = new co.edu.usbcali.egrapico.modelo.Program.Tell();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getLPane().getComponent(i).getY());
                if (((LabelTell) prgm.getLPane().getComponent(i)).isClon() && ((LabelTell) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    tell.setIsclon(true);
                    tell.setHaveConsecuent(true);
                    pf1.setImage("clontellp.gif");
                } else if (!((LabelTell) prgm.getLPane().getComponent(i)).isClon() && ((LabelTell) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    tell.setIsclon(false);
                    tell.setHaveConsecuent(true);
                    pf1.setImage("tell.gif");
                } else if (((LabelTell) prgm.getLPane().getComponent(i)).isClon() && !((LabelTell) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    tell.setIsclon(true);
                    tell.setHaveConsecuent(false);
                    pf1.setImage("clontell.gif");
                } else if (!((LabelTell) prgm.getLPane().getComponent(i)).isClon() && !((LabelTell) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    tell.setIsclon(false);
                    tell.setHaveConsecuent(false);
                    pf1.setImage("tellPreceding.gif");
                }
                pf1.setLabel(prgm.getLPane().getComponent(i).getName());
                pf1.setComment(((LabelTell) prgm.getLPane().getComponent(i)).getTextPane());
                tell.setPhysicPart(pf1);
                LPanePrecedent telAux = ((LabelTell) prgm.getLPane().getComponent(i)).getFrame().getprecedentL().getFrame().getLPane();
                for (int j = 0; j < telAux.getComponentCount(); j++) {
                    co.edu.usbcali.egrapico.modelo.Program.Tell.RestrictionTell rask = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createProgramTellRestrictionTell();
                    co.edu.usbcali.egrapico.modelo.PhysicPart pff = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();
                    pff.setPosX(telAux.getComponent(j).getX());
                    pff.setPosY(telAux.getComponent(j).getY());
                    pff.setImage("genericRestriction.gif");
                    pff.setLabel(telAux.getComponent(j).getName());
                    pff.setComment(((LabelRestriction) telAux.getComponent(j)).getTextPane());
                    rask.setPhysicPart(pff);
                    LPaneRestriction resAux = ((LabelRestriction) telAux.getComponent(j)).getFrame().getLPane();
                    for (int k = 0; k < resAux.getComponentCount(); k++) {
                        if (resAux.getComponent(k) instanceof LabelIdeOpe) {
                            rask.getIdentifier().add(MakeIdentifier((LabelIdeOpe) resAux.getComponent(k)));
                        }
                    }
                    tell.getRestrictionTell().add(rask);
                }
                pro.getTell().add(tell);
            } else if (prgm.getLPane().getComponent(i) instanceof LabelMsgSend) {
                co.edu.usbcali.egrapico.modelo.Program.MsgSend msg = new co.edu.usbcali.egrapico.modelo.Program.MsgSend();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getLPane().getComponent(i).getY());
                if (((LabelMsgSend) prgm.getLPane().getComponent(i)).isClon() && ((LabelMsgSend) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    msg.setIsclon(true);
                    msg.setHaveConsecuent(true);
                    pf1.setImage("clonmsgsend.gif");
                } else if (!((LabelMsgSend) prgm.getLPane().getComponent(i)).isClon() && ((LabelMsgSend) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    msg.setIsclon(false);
                    msg.setHaveConsecuent(true);
                    pf1.setImage("msgSend.gif");
                } else if (((LabelMsgSend) prgm.getLPane().getComponent(i)).isClon() && !((LabelMsgSend) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    msg.setIsclon(true);
                    msg.setHaveConsecuent(false);
                    pf1.setImage("clonmsgSendPreceding.gif");
                } else if (!((LabelMsgSend) prgm.getLPane().getComponent(i)).isClon() && !((LabelMsgSend) prgm.getLPane().getComponent(i)).getIsConsecuent()) {
                    msg.setIsclon(false);
                    msg.setHaveConsecuent(false);
                    pf1.setImage("msgSendPreceding.gif");
                }
                pf1.setLabel(prgm.getLPane().getComponent(i).getName());
                pf1.setComment(((LabelMsgSend) prgm.getLPane().getComponent(i)).getTextPane());
                msg.setPhysicPart(pf1);
                msg.setIdentifier(MakeIdentifier(((LabelMsgSend) prgm.getLPane().getComponent(i)).getFrame().getprecedentL().getFrame().getIdObject()));
                msg.setMethodName(((LabelMsgSend) prgm.getLPane().getComponent(i)).getFrame().getprecedentL().getFrame().getMethodObject().getName());
                LPaneRestrictionMsg puertos = ((LabelMsgSend) prgm.getLPane().getComponent(i)).getFrame().getprecedentL().getFrame().getLayered();
                for (int k = 0; k < puertos.getComponentCount(); k++) {
                    if (puertos.getComponent(k) instanceof LabelIdeOpe) {
                        if (!((LabelIdeOpe) puertos.getComponent(k)).getIcon().toString().endsWith("argumentP.gif")) {
                            msg.getArgument().add(MakeIdentifier((LabelIdeOpe) puertos.getComponent(k)));
                        }
                    }
                }
                pro.getMsgSend().add(msg);
            }
        }
        return pro;
    }

    public co.edu.usbcali.egrapico.modelo.Program MakeProgram(LabelProgram prgm) {
        co.edu.usbcali.egrapico.modelo.Program pro = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createProgram();
        co.edu.usbcali.egrapico.modelo.PhysicPart pf = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

        pf.setPosX(prgm.getFrame().getX());
        pf.setPosY(prgm.getFrame().getY());
        pf.setImage("program.gif");
        pf.setLabel(prgm.getName());
        pf.setComment(prgm.getTextPane());
        pro.setPhisicProgram(pf);

        for (int i = 0; i < prgm.getFrame().getLPane().getComponentCount(); i++) {
            if (prgm.getFrame().getLPane().getComponent(i) instanceof LabelContext) {
                co.edu.usbcali.egrapico.modelo.Program.Context context = new co.edu.usbcali.egrapico.modelo.Program.Context();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getFrame().getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getFrame().getLPane().getComponent(i).getY());
                if (((LabelContext) prgm.getFrame().getLPane().getComponent(i)).isClon()) {
                    context.setIsclon(true);
                    pf1.setImage("cloncontex.gif");
                } else {
                    context.setIsclon(false);
                    pf1.setImage("context.gif");
                }
                pf1.setLabel(prgm.getFrame().getLPane().getComponent(i).getName());
                pf1.setComment(((LabelContext) prgm.getFrame().getLPane().getComponent(i)).getTextPane());
                context.setPhysicPart(pf1);
                for (int j = 0; j < ((LabelContext) prgm.getFrame().getLPane().getComponent(i)).getFrame().getLPane().getComponentCount(); j++) {
                    if (((LabelContext) prgm.getFrame().getLPane().getComponent(i)).getFrame().getLPane().getComponent(j) instanceof LabelIdeOpe) {
                        context.getIdentifier().add(MakeIdentifier((LabelIdeOpe) ((LabelContext) prgm.getFrame().getLPane().getComponent(i)).getFrame().getLPane().getComponent(j)));
                    } else if (((LabelContext) prgm.getFrame().getLPane().getComponent(i)).getFrame().getLPane().getComponent(j) instanceof LabelMethod) {
                        context.getMethodLabel().add(MakeLabelMethod((LabelMethod) ((LabelContext) prgm.getFrame().getLPane().getComponent(i)).getFrame().getLPane().getComponent(j)));
                    } else if (((LabelContext) prgm.getFrame().getLPane().getComponent(i)).getFrame().getLPane().getComponent(j) instanceof LabelProgram) {
                        context.setProgram(MakeProgram((LabelProgram) ((LabelContext) prgm.getFrame().getLPane().getComponent(i)).getFrame().getLPane().getComponent(j)));
                    }
                }
                pro.getContext().add(context);
            } else if (prgm.getFrame().getLPane().getComponent(i) instanceof LabelObject) {
                co.edu.usbcali.egrapico.modelo.Program.ObjectLabel obje = new co.edu.usbcali.egrapico.modelo.Program.ObjectLabel();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getFrame().getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getFrame().getLPane().getComponent(i).getY());
                if (((LabelObject) prgm.getFrame().getLPane().getComponent(i)).isClon()) {
                    obje.setIsclon(true);
                    pf1.setImage("clon_object.gif");
                } else {
                    obje.setIsclon(false);
                    pf1.setImage("object.gif");
                }
                pf1.setLabel(prgm.getFrame().getLPane().getComponent(i).getName());
                pf1.setComment(((LabelObject) prgm.getFrame().getLPane().getComponent(i)).getTextPane());
                obje.setPhysicPart(pf1);
                pro.getObjectLabel().add(obje);
            } else if (prgm.getFrame().getLPane().getComponent(i) instanceof LabelAsk) {
                co.edu.usbcali.egrapico.modelo.Program.Ask ask = new co.edu.usbcali.egrapico.modelo.Program.Ask();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getFrame().getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getFrame().getLPane().getComponent(i).getY());
                if (((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).isClon() && ((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    ask.setIsclon(true);
                    ask.setHaveConsecuent(true);
                    pf1.setImage("clonask.gif");
                } else if (!((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).isClon() && ((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    ask.setIsclon(false);
                    ask.setHaveConsecuent(true);
                    pf1.setImage("ask.gif");
                } else if (((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).isClon() && !((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    ask.setIsclon(true);
                    ask.setHaveConsecuent(false);
                    pf1.setImage("clon_ask1.gif");
                } else if (!((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).isClon() && !((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    ask.setIsclon(false);
                    ask.setHaveConsecuent(false);
                    pf1.setImage("askPreceding.gif");
                }
                pf1.setLabel(prgm.getFrame().getLPane().getComponent(i).getName());
                pf1.setComment(((LabelAsk) prgm.getFrame().getLPane().getComponent(i)).getTextPane());
                ask.setPhysicPart(pf1);
                pro.getAsk().add(ask);
            } else if (prgm.getFrame().getLPane().getComponent(i) instanceof LabelTell) {
                co.edu.usbcali.egrapico.modelo.Program.Tell tell = new co.edu.usbcali.egrapico.modelo.Program.Tell();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getFrame().getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getFrame().getLPane().getComponent(i).getY());
                if (((LabelTell) prgm.getFrame().getLPane().getComponent(i)).isClon() && ((LabelTell) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    tell.setIsclon(true);
                    tell.setHaveConsecuent(true);
                    pf1.setImage("clontellp.gif");
                } else if (!((LabelTell) prgm.getFrame().getLPane().getComponent(i)).isClon() && ((LabelTell) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    tell.setIsclon(false);
                    tell.setHaveConsecuent(true);
                    pf1.setImage("tell.gif");
                } else if (((LabelTell) prgm.getFrame().getLPane().getComponent(i)).isClon() && !((LabelTell) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    tell.setIsclon(true);
                    tell.setHaveConsecuent(false);
                    pf1.setImage("clontell.gif");
                } else if (!((LabelTell) prgm.getFrame().getLPane().getComponent(i)).isClon() && !((LabelTell) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    tell.setIsclon(false);
                    tell.setHaveConsecuent(false);
                    pf1.setImage("tellPreceding.gif");
                }
                pf1.setLabel(prgm.getFrame().getLPane().getComponent(i).getName());
                pf1.setComment(((LabelTell) prgm.getFrame().getLPane().getComponent(i)).getTextPane());
                tell.setPhysicPart(pf1);
                pro.getTell().add(tell);
            } else if (prgm.getFrame().getLPane().getComponent(i) instanceof LabelMsgSend) {
                co.edu.usbcali.egrapico.modelo.Program.MsgSend msg = new co.edu.usbcali.egrapico.modelo.Program.MsgSend();
                co.edu.usbcali.egrapico.modelo.PhysicPart pf1 = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

                pf1.setPosX(prgm.getFrame().getLPane().getComponent(i).getX());
                pf1.setPosY(prgm.getFrame().getLPane().getComponent(i).getY());
                if (((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).isClon() && ((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    msg.setIsclon(true);
                    msg.setHaveConsecuent(true);
                    pf1.setImage("clonmsgsend.gif");
                } else if (!((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).isClon() && ((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    msg.setIsclon(false);
                    msg.setHaveConsecuent(true);
                    pf1.setImage("msgSend.gif");
                } else if (((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).isClon() && !((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    msg.setIsclon(true);
                    msg.setHaveConsecuent(false);
                    pf1.setImage("clonmsgSendPreceding.gif");
                } else if (!((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).isClon() && !((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).getIsConsecuent()) {
                    msg.setIsclon(false);
                    msg.setHaveConsecuent(false);
                    pf1.setImage("msgSendPreceding.gif");
                }
                pf1.setLabel(prgm.getFrame().getLPane().getComponent(i).getName());
                pf1.setComment(((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).getTextPane());
                msg.setIdentifier(MakeIdentifier(((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).getFrame().getprecedentL().getFrame().getIdObject()));
                msg.setMethodName(((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).getFrame().getprecedentL().getFrame().getMethodObject().getName());
                msg.setPhysicPart(pf1);
                LPaneRestrictionMsg puertos = ((LabelMsgSend) prgm.getFrame().getLPane().getComponent(i)).getFrame().getprecedentL().getFrame().getLayered();
                for (int k = 0; k < puertos.getComponentCount(); k++) {
                    if (puertos.getComponent(k) instanceof LabelIdeOpe) {
                        if (!((LabelIdeOpe) puertos.getComponent(k)).getIcon().toString().endsWith("argumentP.gif")) {
                            msg.getArgument().add(MakeIdentifier((LabelIdeOpe) puertos.getComponent(k)));
                        }
                    }
                }
                pro.getMsgSend().add(msg);
            }
        }
        return pro;
    }

    public co.edu.usbcali.egrapico.modelo.Identifier MakeIdentifier(LabelIdeOpe idt) {
        co.edu.usbcali.egrapico.modelo.Identifier idop = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createIdentifier();
        co.edu.usbcali.egrapico.modelo.PhysicPart pf = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

        pf.setPosX(idt.getX());
        pf.setPosY(idt.getY());
        pf.setImage(idt.getNameIcon());
        pf.setLabel(idt.getName());
        pf.setComment(idt.getTextPane());
        idop.setIdOrder(idt.getId());
        idop.setPhysicPart(pf);

        return idop;
    }

    public co.edu.usbcali.egrapico.modelo.Program.Context.MethodLabel MakeLabelMethod(LabelMethod me) {
        co.edu.usbcali.egrapico.modelo.Program.Context.MethodLabel meto = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createProgramContextMethodLabel();
        co.edu.usbcali.egrapico.modelo.PhysicPart pf = new co.edu.usbcali.egrapico.modelo.ObjectFactory().createPhysicPart();

        pf.setPosX(me.getX());
        pf.setPosY(me.getY());
        pf.setImage("method.gif");
        pf.setLabel(me.getName());
        pf.setComment(me.getTextPane());
        meto.setPhysicPart(pf);

        return meto;
    }
    //empiesa traduccion entregada al compilador

    public static String MakeText(java.awt.Component c) {   //funci�n recursiva 
        String p = "";

        //******************** PROGRAMA ********************************      
        if (c instanceof PanelProgram) {
            // ((PanelProgram)c).getLPane().ApIcons(null);
            String parteLogica = "";
            p = "{(" + String.valueOf(((PanelProgram) c).getX())
                    + "-" + String.valueOf(((PanelProgram) c).getY()) + ")program.gif~" + ((PanelProgram) c).getNameP() + ":";
            if (((PanelProgram) c).getLPane().getComponentCount() > 1) {
                p = p + "(";
            }
            int n = 0;
            while (n < ((PanelProgram) c).getLPane().getComponentCount()) {
                parteLogica = parteLogica + "|" + MakeText(((PanelProgram) c).getLPane().getComponent(n));
                n++;
            }
            if (parteLogica.length() == 0) {
                p = p + "}\r\n";
            } else {
                if (((PanelProgram) c).getLPane().getComponentCount() > 1) {
                    p = p + parteLogica.substring(1) + ")}\r\n";
                } else {
                    p = p + parteLogica.substring(1) + "}\r\n";
                }
            }
        } else if (c instanceof LabelProgram) {
            // ((LabelProgram)c).getFrame().getLPane().ApIcons(null);
            String parteLogica = "";
            p = "{(" + String.valueOf(((LabelProgram) c).getX())
                    + "-" + String.valueOf(((LabelProgram) c).getY()) + ")program.gif~" + c.getName() + ":";
            if (((LabelProgram) c).getFrame().getLPane().getComponentCount() > 1) {
                p = p + "(";
            }
            int n = 0;
            while (n < ((LabelProgram) c).getFrame().getLPane().getComponentCount()) {
                parteLogica = parteLogica + "|" + MakeText(((LabelProgram) c).getFrame().getLPane().getComponent(n));
                n++;
            }
            if (parteLogica.length() == 0) {
                p = p + "}\r\n";
            } else {
                if (((LabelProgram) c).getFrame().getLPane().getComponentCount() > 1) {
                    p = p + parteLogica.substring(1) + ")}\r\n";
                } else {
                    p = p + parteLogica.substring(1) + "}\r\n";
                }
            }
        } // 1 *********************AMBITO*********************************
        else if (c instanceof LabelContext) {
            ((LabelContext) c).getFrame().getLPane().ApIcons(null);
            String listaNombres = "", listaVariables = "", programa = "";
            if (((LabelContext) c).isClon()) {
                p = "*";
            }
            p = p + "(" + String.valueOf(((LabelContext) c).getX())
                    + "-" + String.valueOf(((LabelContext) c).getY()) + ")context.gif~" + c.getName() + ":[";
            int n = 0;
            if (((LabelContext) c).isCreate() == true) {
                while (n < ((LabelContext) c).getFrame().getLPane().getComponentCount()) {
                    if (((LabelContext) c).getFrame().getLPane().getComponent(n) instanceof LabelMethod) {
                        listaNombres = listaNombres + "," + MakeText(((LabelContext) c).getFrame().getLPane().getComponent(n));
                    } else if (((LabelContext) c).getFrame().getLPane().getComponent(n) instanceof LabelIdeOpe) {
                        listaVariables = listaVariables + "," + MakeText(((LabelContext) c).getFrame().getLPane().getComponent(n));
                    } else if (((LabelContext) c).getFrame().getLPane().getComponent(n) instanceof LabelProgram) {
                        programa = programa + MakeText(((LabelContext) c).getFrame().getLPane().getComponent(n));
                    }
                    n++;
                }
            }
            if (listaVariables.length() == 0) {
                p = p + ";";
            } else {
                p = p + listaVariables.substring(1) + ";";
            }
            if (listaNombres.length() == 0) {
                p = p + ";";
            } else {
                p = p + listaNombres.substring(1) + ";";
            }
            p = p + programa + "]\r\n";

        } //*****************************METODOS***********************************
        else if (c instanceof LabelMethod) {
            p = "(" + String.valueOf(((LabelMethod) c).getX())
                    + "-" + String.valueOf(((LabelMethod) c).getY()) + ")method.gif~" + c.getName();
        } else if (c instanceof MethodList) {
            ((MethodList) c).getFrame().getLPane().ApIcons(null);
            String listaParametros = "", programa = "";
            p = ((MethodList) c).getID() + ":(";
            int n = 0;
            while (n < ((MethodList) c).getFrame().getLPane().getComponentCount()) {
                if (((MethodList) c).getFrame().getLPane().getComponent(n) instanceof LabelProgram) {
                    LabelProgram prgm = (LabelProgram) ((MethodList) c).getFrame().getLPane().getComponent(n);
                    programa = MakeText(prgm);
                } else {
                    listaParametros = listaParametros + "," + MakeText(((MethodList) c).getFrame().getLPane().getComponent(n));
                }
                n++;
            }

            if (listaParametros.length() == 0) {
                p = p + ")" + programa;
            } else {
                p = p + listaParametros.substring(1) + ")" + programa;
            }
        } //********************************IDENTIFOCADORES**************************
        else if (c instanceof LabelIdeOpe) {
            if (((LabelIdeOpe) c).getId().equals("id1")) // identificador de restricciones   
            {
                p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                        + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")";
            } else if (((LabelIdeOpe) c).getId().equals("id2")
                    || ((LabelIdeOpe) c).getId().equals("id4")
                    || ((LabelIdeOpe) c).getId().equals("id5")) {
                if (((LabelIdeOpe) c).getIcon().toString().endsWith("value.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")value.gif~" + c.getName();
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("variable.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")variable.gif~" + c.getName();
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("argument.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")argument.gif~" + c.getName();
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("argumentP.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")argumentP.gif~" + c.getName();
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("senderOperator.gif")) {
                    if (((LabelIdeOpe) c).getisObject() == true) {
                        p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                                + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")senderOperator.gif~sender"; //p="sender";
                    } else if (((LabelIdeOpe) c).getisObject() == false) {
                        p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                                + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")senderOperator.gif~sender";
                    }
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("forwardOperator.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")forwardOperator.gif~forward"; //p="forward";

                }
            } else if (((LabelIdeOpe) c).getId().equals("id3")) {
                if (((LabelIdeOpe) c).getIcon().toString().endsWith("value.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")value.gif~" + c.getName();
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("variable.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")variable.gif~" + c.getName();
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("argument.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")argument.gif~" + c.getName();
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("senderOperator.gif")) {
                    if (((LabelIdeOpe) c).getisObject() == true) {
                        p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                                + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")senderOperator.gif~sender";//p="sender";
                    } else if (((LabelIdeOpe) c).getisObject() == false) {
                        p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                                + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")senderOperator.gif~sender";
                    }
                } else if (((LabelIdeOpe) c).getIcon().toString().endsWith("forwardOperator.gif")) {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX())
                            + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")forwardOperator.gif~forward";//p="forward";

                } else {
                    p = "(" + String.valueOf(((LabelIdeOpe) c).getX()) + "-" + String.valueOf(((LabelIdeOpe) c).getY()) + ")";
                }
            }
        } // 2 ***************************OBJETOS**************************************** 
        else if (c instanceof LabelObject) {
            String forwardRestriction = "", senderRestriction = "", listaMetodos = "";
            if (((LabelObject) c).isClon()) {
                p = "*";
            }
            p = p + "(" + String.valueOf(((LabelObject) c).getX())
                    + "-" + String.valueOf(((LabelObject) c).getY()) + ")object.gif~" + c.getName() + ":(";
            int n = 0;
            ObjectAtList obje = getObjeto(c.getName());
            while (n < obje.getFrame().getSender().getFrame().getLPane().getComponentCount()) {
                senderRestriction = senderRestriction + "^" + MakeText(obje.getFrame().getSender().getFrame().getLPane().getComponent(n));
                n++;
            }
            n = 0;
            while (n < obje.getFrame().getForward().getFrame().getLPane().getComponentCount()) {
                forwardRestriction = forwardRestriction + "^" + MakeText(obje.getFrame().getForward().getFrame().getLPane().getComponent(n));
                n++;
            }
            n = 0;
            while (n < obje.getFrame().getPropertiesFrame().getFrame().getComponentPanelcount()) {
                listaMetodos = listaMetodos + "&" + MakeText(obje.getFrame().getPropertiesFrame().getFrame().getMethod(n));
                n++;
            }

            if (senderRestriction.length() == 0) {
                p = p + ",";
            } else {
                if (obje.getFrame().getSender().getFrame().getLPane().getComponentCount() > 1) {
                    p = p + "(" + senderRestriction.substring(1) + "),";
                } else {
                    p = p + senderRestriction.substring(1) + ",";
                }
            }
            if (forwardRestriction.length() == 0) {
                p = p + ")";
            } else {
                if (obje.getFrame().getForward().getFrame().getLPane().getComponentCount() > 1) {
                    p = p + "(" + forwardRestriction.substring(1) + "))";
                } else {
                    p = p + forwardRestriction.substring(1) + ")";
                }
            }
            if (listaMetodos.length() == 0) {
                p = p + "�[]\r\n";
            } else {
                p = p + "�[" + listaMetodos.substring(1) + "]\r\n";
            }
        } //**************************RESTRICCIONES****************************
        else if (c instanceof LabelRestriction) { //restriccion de recepcion          
            String parteIz = "", comparacion = "", parteDe = "", operadorIz = "", operadorDe = "";
            int n = 0;
            ((LabelRestriction) c).getFrame().getLPane().ApIcons(null);
            while (n < ((LabelRestriction) c).getFrame().getLPane().getComponentCount()) {
                if (((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getId().equals("id1")) {
                    comparacion = MakeText(((LabelRestriction) c).getFrame().getLPane().getComponent(n))
                            + ((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getSimbol();
                } else if (((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getId().equals("id2")) {
                    parteIz = MakeText(((LabelRestriction) c).getFrame().getLPane().getComponent(n));//+((LabelIdeOpe)((LabelRestriction)c).getFrame().getLPane().getComponent(n)).getSimbol();
                } else if (((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getId().equals("id3")) {
                    parteDe = MakeText(((LabelRestriction) c).getFrame().getLPane().getComponent(n))
                            + ((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getSimbol();
                } else if (((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getId().equals("id4")) {
                    operadorIz = MakeText(((LabelRestriction) c).getFrame().getLPane().getComponent(n))
                            + ((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getSimbol();
                } else if (((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getId().equals("id5")) {
                    operadorDe = MakeText(((LabelRestriction) c).getFrame().getLPane().getComponent(n))
                            + ((LabelIdeOpe) ((LabelRestriction) c).getFrame().getLPane().getComponent(n)).getSimbol();
                }
                n++;
            }
            if (operadorIz.length() == 0 || operadorDe.length() == 0) {
                p = p + parteIz + comparacion + parteDe;
            } else {
                p = p + parteIz + comparacion + operadorIz + parteDe + operadorDe;
            }
        } else if (c instanceof LabelRestrictionF) { //restriccion de delegacion 
            // ((LabelRestrictionF)c).getFrame().getLPane().ApIcons(null);  
            String parteIz = "", comparacion = "", parteDe = "", operadorIz = "", operadorDe = "";
            int n = 0;
            ((LabelRestrictionF) c).getFrame().getLPane().ApIcons(null);
            while (n < ((LabelRestrictionF) c).getFrame().getLPane().getComponentCount()) {
                if (((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getId().equals("id1")) {
                    comparacion = MakeText(((LabelRestrictionF) c).getFrame().getLPane().getComponent(n))
                            + ((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getSimbol();
                } else if (((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getId().equals("id2")) {
                    parteIz = MakeText(((LabelRestrictionF) c).getFrame().getLPane().getComponent(n));//+((LabelIdeOpe)((LabelRestriction)c).getFrame().getLPane().getComponent(n)).getSimbol();
                } else if (((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getId().equals("id3")) {
                    parteDe = MakeText(((LabelRestrictionF) c).getFrame().getLPane().getComponent(n))
                            + ((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getSimbol();
                } else if (((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getId().equals("id4")) {
                    operadorIz = MakeText(((LabelRestrictionF) c).getFrame().getLPane().getComponent(n))
                            + ((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getSimbol();
                } else if (((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getId().equals("id5")) {
                    operadorDe = MakeText(((LabelRestrictionF) c).getFrame().getLPane().getComponent(n))
                            + ((LabelIdeOpe) ((LabelRestrictionF) c).getFrame().getLPane().getComponent(n)).getSimbol();
                }
                n++;
            }
            if (operadorIz.length() == 0 || operadorDe.length() == 0) {
                p = p + parteIz + comparacion + parteDe;
            } else {
                p = p + parteIz + comparacion + operadorIz + parteDe + operadorDe;
            }

        } // 3 ******************************IMPLICACIONES*****************************
        else if (c instanceof LabelAsk) {
            String listaRestricciones = "", progra = "";
            if (((LabelAsk) c).isClon()) {
                p = "*";
            }
            p = p + "(" + String.valueOf(((LabelAsk) c).getX())
                    + "-" + String.valueOf(((LabelAsk) c).getY()) + ")ask.gif~" + c.getName() + ":<?";
            int n = 0;
            // ((LabelAsk)c).getFrame().getprecedentL().getFrame().getLPane().ApIcons(null);
            int rp = ((LabelAsk) c).getFrame().getprecedentL().getFrame().getLPane().getComponentCount();
            if (rp > 1) {
                p = p + "(";
            }
            while (n < rp) {
                listaRestricciones = listaRestricciones + "^" + MakeText(((LabelAsk) c).getFrame().getprecedentL().getFrame().getLPane().getComponent(n));
                n++;
            }
            if (((LabelAsk) c).getIsConsecuent()) {
                progra = MakeText(((LabelAsk) c).getFrame().getprogramL());
            }
            if (listaRestricciones.length() == 0) {
                p = p + ";" + progra + ">";
            } else {
                if (rp > 1) {
                    p = p + listaRestricciones.substring(1) + ");" + progra + ">";
                } else {
                    p = p + listaRestricciones.substring(1) + ";" + progra + ">";
                }
            }
        } else if (c instanceof LabelTell) {
            String listaRestricciones = "", progra = "";
            if (((LabelTell) c).isClon()) {
                p = "*";
            }
            p = p + "(" + String.valueOf(((LabelTell) c).getX())
                    + "-" + String.valueOf(((LabelTell) c).getY()) + ")tell.gif~" + c.getName() + ":<!";
            int n = 0;
            //((LabelTell)c).getFrame().getprecedentL().getFrame().getLPane().ApIcons(null);
            int rp = ((LabelTell) c).getFrame().getprecedentL().getFrame().getLPane().getComponentCount();
            if (rp > 1) {
                p = p + "(";
            }
            while (n < rp) {
                listaRestricciones = listaRestricciones + "^" + MakeText(((LabelTell) c).getFrame().getprecedentL().getFrame().getLPane().getComponent(n));
                n++;
            }
            if (((LabelTell) c).getIsConsecuent()) {
                progra = MakeText(((LabelTell) c).getFrame().getprogramL());
            }
            if (listaRestricciones.length() == 0) {
                p = p + ";" + progra + ">";
            } else {
                if (rp > 1) {
                    p = p + listaRestricciones.substring(1) + ");" + progra + ">";
                } else {
                    p = p + listaRestricciones.substring(1) + ";" + progra + ">";
                }
            }
        } else if (c instanceof LabelMsgSend) {
            String identifi = "", listaNombres = "", listaAplicaciones = "", progra = "", mensaje = "";
            if (((LabelMsgSend) c).isClon()) {
                p = "*";
            }
            p = p + "(" + String.valueOf(((LabelMsgSend) c).getX())
                    + "-" + String.valueOf(((LabelMsgSend) c).getY()) + ")msgSend.gif~" + c.getName() + ":<";
            int n = 0;
            if (((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getidentificador() == 1) {
                identifi = MakeText(((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getIdObject()) + "�";
            } else {
                identifi = "�";
            }
            if (((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getmethodCount() == 1) {
                mensaje = ((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getMethodObject().getName() + ":[";
                while (n < ((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getLPane().getComponentCount()) {
                    String puerto = "", identificador = "";
                    if (((LabelIdeOpe) ((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getLPane().getComponent(n)).getIcon().toString().endsWith("argumentP.gif")) {
                        puerto = "(" + MakeText(((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getLPane().getComponent(n)) + ")";
                        int posx = ((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getLPane().getComponent(n).getX() + 100;
                        int posy = ((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getLPane().getComponent(n).getY();
                        identificador = MakeText(((LabelMsgSend) c).getFrame().getprecedentL().getFrame().getLPane().getComponentAt(posx, posy));
                        listaAplicaciones = listaAplicaciones + "," + puerto + identificador;
                    }
                    n++;
                }

            } else {
                mensaje = ":[";
            }
            if (listaAplicaciones.length() == 0) {
                mensaje = mensaje + "]";
            } else {
                mensaje = mensaje + listaAplicaciones.substring(1) + "]";
            }
            if (((LabelMsgSend) c).getIsConsecuent()) {
                progra = MakeText(((LabelMsgSend) c).getFrame().getprogramL());
            }
            p = p + identifi + mensaje + ";" + progra + ">";
        }
        return p;
    }

    private void file_openActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_file_openActionPerformed
//JFileChooser _File=new JFileChooser();
        btnNewActionPerformed(evt);
        int opcion = Save_File.showOpenDialog(this);
        if (opcion == JFileChooser.APPROVE_OPTION && Save_File.getSelectedFile().getName().contains(".xml")) {
            try {
                java.io.FileInputStream fisFrame = new java.io.FileInputStream(Save_File.getSelectedFile().getPath());
                javax.xml.bind.Unmarshaller unmarshaller = javax.xml.bind.JAXBContext.newInstance("org.netbeans.xml.schema.schemagrapico").createUnmarshaller();
                co.edu.usbcali.egrapico.modelo.GrapicoFile root = (co.edu.usbcali.egrapico.modelo.GrapicoFile) (unmarshaller.unmarshal(fisFrame));
                co.edu.usbcali.egrapico.modelo.Program pro = root.getProgram();

                jdpAreaTrabajo.removeAll();
                jdpAreaTrabajo.repaint();
                Iframe = new PanelProgram();
                Iframe.setTitle("Main");
                jdpAreaTrabajo.add(Iframe);

                java.util.Iterator<co.edu.usbcali.egrapico.modelo.Object> ot = root.getObjectDef().iterator();
                while (ot.hasNext()) {
                    co.edu.usbcali.egrapico.modelo.Object oot = ot.next();
                    //adicionamos el objeto
                    obj = new ObjectAtList(oot.getName());
                    obj.getFrame().getForward().setNameParent(obj.getID());
                    obj.getFrame().getForward().getFrame().setTitle(obj.getID() + ".Restriction.Forward");
                    java.util.Iterator<co.edu.usbcali.egrapico.modelo.Object.ForwardRestriction> of = oot.getForwardRestriction().iterator();
                    while (of.hasNext()) {
                        co.edu.usbcali.egrapico.modelo.Object.ForwardRestriction oof = of.next();
                        LabelRestrictionF lrf = new LabelRestrictionF();
                        javax.swing.ImageIcon I0 = new javax.swing.ImageIcon(getClass().getResource("co/edu/usbcali/egrapico/images/forwardRestriction.gif"));
                        lrf.setIcon(I0);
                        lrf.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
                        lrf.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
                        lrf.setName(oof.getPhysicPart().getLabel());
                        lrf.setLocation(oof.getPhysicPart().getPosX(), oof.getPhysicPart().getPosY());
                        lrf.setSize(90, 90);
                        lrf.setTextPane(oof.getPhysicPart().getComment());
                        lrf.setToolTipText(lrf.getName() + ": " + lrf.getTextPane());
                        lrf.getFrame().loadFrame(oof.getIdentifier().iterator());

                        obj.getFrame().getForward().getFrame().addLayeredPane(lrf);
                    }
                    java.util.Iterator<co.edu.usbcali.egrapico.modelo.Object.SenderRestriction> os = oot.getSenderRestriction().iterator();
                    while (os.hasNext()) {
                        co.edu.usbcali.egrapico.modelo.Object.SenderRestriction oos = os.next();
                    }
                    java.util.Iterator<co.edu.usbcali.egrapico.modelo.Object.Method> om = oot.getMethod().iterator();
                    while (om.hasNext()) {
                        co.edu.usbcali.egrapico.modelo.Object.Method oom = om.next();
                    }
                    adicionarObjeto(obj);
                }
                Iframe.loadFrame(pro);
            } catch (Exception e) {
                lblContexto.setText("wrong to open" + e.toString());
            }

        }
    }//GEN-LAST:event_file_openActionPerformed

    private void jTree4ValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jTree4ValueChanged
// TODO add your handling code here:
        javax.swing.tree.DefaultMutableTreeNode nodoseleccionado = (javax.swing.tree.DefaultMutableTreeNode) jTree4.getLastSelectedPathComponent();

    }//GEN-LAST:event_jTree4ValueChanged

    private void jTree3ValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jTree3ValueChanged
// TODO add your handling code here:
        javax.swing.tree.DefaultMutableTreeNode nodoseleccionado = (javax.swing.tree.DefaultMutableTreeNode) jTree3.getLastSelectedPathComponent();

    }//GEN-LAST:event_jTree3ValueChanged

    private void jTree1MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree1MouseMoved
        // TODO add your handling code here:
        jTree1.setSelectionPath(jTree1.getPathForLocation(evt.getX(), evt.getY()));

    }//GEN-LAST:event_jTree1MouseMoved

    private void jTree2MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree2MouseMoved
        // TODO add your handling code here:
        jTree2.setSelectionPath(jTree2.getPathForLocation(evt.getX(), evt.getY()));
    }//GEN-LAST:event_jTree2MouseMoved

    private void jTree3MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree3MouseMoved
        // TODO add your handling code here:
        jTree3.setSelectionPath(jTree3.getPathForLocation(evt.getX(), evt.getY()));
    }//GEN-LAST:event_jTree3MouseMoved

    private void jTree4MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree4MouseMoved
        // TODO add your handling code here:
        jTree4.setSelectionPath(jTree4.getPathForLocation(evt.getX(), evt.getY()));
    }//GEN-LAST:event_jTree4MouseMoved

    private void jTree5MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree5MouseMoved
        // TODO add your handling code here:
        jTree5.setSelectionPath(jTree5.getPathForLocation(evt.getX(), evt.getY()));
    }//GEN-LAST:event_jTree5MouseMoved

    private void jTree6MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree6MouseMoved
        // TODO add your handling code here:
        jTree6.setSelectionPath(jTree6.getPathForLocation(evt.getX(), evt.getY()));
    }//GEN-LAST:event_jTree6MouseMoved

    private void jTree7MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree7MouseMoved
        // TODO add your handling code here:
        jTree7.setSelectionPath(jTree7.getPathForLocation(evt.getX(), evt.getY()));
    }//GEN-LAST:event_jTree7MouseMoved

    private void jTree8MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree8MouseMoved
        // TODO add your handling code here:
        jTree8.setSelectionPath(jTree8.getPathForLocation(evt.getX(), evt.getY()));
    }//GEN-LAST:event_jTree8MouseMoved

    private void jTree9MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree9MouseMoved
        // TODO add your handling code here:
        jTree9.setSelectionPath(jTree9.getPathForLocation(evt.getX(), evt.getY()));
    }//GEN-LAST:event_jTree9MouseMoved

    private void build_compileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_build_compileActionPerformed
        // TODO add your handling code here:
        file_saveActionPerformed(evt);
        txtFileGraPicoT.setText("");
        txtTraslatePico.setText("");
        txtmsgSemantic.setText("");
        String GraPiCOTextual = "", PiCO = "";
        Iframe.setNameP(Save_File.getSelectedFile().getName().substring(0, Save_File.getSelectedFile().getName().length() - 4));
        GraPiCOTextual = MakeText(Iframe);
        txtFileGraPicoT.append(GraPiCOTextual);
        Traslator fileTraslate = new Traslator(GraPiCOTextual);
        PiCO = fileTraslate.traslate();
        txtTraslatePico.setText(PiCO);
        java.util.Hashtable messagesHashtable = fileTraslate.getMessagesHashtable();
        GetSumarySemanticAnalizer(messagesHashtable);
    }//GEN-LAST:event_build_compileActionPerformed

    private void file_exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_file_exitActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_file_exitActionPerformed

    private void btnRedoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRedoActionPerformed
// TODO add your handling code here:
        javax.swing.JComponent c = jdpAreaTrabajo.getSelectedFrame();
        if (c instanceof PanelProgram) {
            ((PanelProgram) c).setRedoLPane();
            if (((PanelProgram) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelProgram) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelContext) {
            ((PanelContext) c).setRedoLPane();
            if (((PanelContext) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelContext) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelPrecedent) {
            ((PanelPrecedent) c).setRedoLPane();
            if (((PanelPrecedent) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelPrecedent) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelRestriction) {
            ((PanelRestriction) c).setRedoLPane();
            if (((PanelRestriction) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelRestriction) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelPrecedentMsg) {
            ((PanelPrecedentMsg) c).setRedoLPane();
            if (((PanelPrecedentMsg) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelPrecedentMsg) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelRestrictionF) {
            ((PanelRestrictionF) c).setRedoLPane();
            if (((PanelRestrictionF) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelRestrictionF) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelPrecedentForward) {
            ((PanelPrecedentForward) c).setRedoLPane();
            if (((PanelPrecedentForward) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelPrecedentForward) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelPrecedentSender) {
            ((PanelPrecedentSender) c).setRedoLPane();
            if (((PanelPrecedentSender) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelPrecedentSender) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        }
    }//GEN-LAST:event_btnRedoActionPerformed

    private void btnUndoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUndoActionPerformed
// TODO add your handling code here:
        javax.swing.JComponent c = jdpAreaTrabajo.getSelectedFrame();
        if (c instanceof PanelProgram) {
            ((PanelProgram) c).setUndoLPane();
            if (((PanelProgram) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelProgram) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelContext) {
            ((PanelContext) c).setUndoLPane();
            if (((PanelContext) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelContext) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelPrecedent) {
            ((PanelPrecedent) c).setUndoLPane();
            if (((PanelPrecedent) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelPrecedent) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelRestriction) {
            ((PanelRestriction) c).setUndoLPane();
            if (((PanelRestriction) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelRestriction) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelPrecedentMsg) {
            ((PanelPrecedentMsg) c).setUndoLPane();
            if (((PanelPrecedentMsg) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelPrecedentMsg) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelRestrictionF) {
            ((PanelRestrictionF) c).setUndoLPane();
            if (((PanelRestrictionF) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelRestrictionF) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelPrecedentForward) {
            ((PanelPrecedentForward) c).setUndoLPane();
            if (((PanelPrecedentForward) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelPrecedentForward) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        } else if (c instanceof PanelPrecedentSender) {
            ((PanelPrecedentSender) c).setUndoLPane();
            if (((PanelPrecedentSender) c).getRedosize() == 0) {
                btnUndo.setEnabled(false);
                btnRedo.setEnabled(true);
            } else {
                btnUndo.setEnabled(true);
            }
            if (((PanelPrecedentSender) c).getUndosize() == 0) {
                btnRedo.setEnabled(false);
                btnUndo.setEnabled(true);
            } else {
                btnRedo.setEnabled(true);
            }
        }
    }//GEN-LAST:event_btnUndoActionPerformed

    private void btnZoomInActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnZoomInActionPerformed
        // TODO add your handling code here: zoom+funcion      
        for (int i = 0; i < Iframe.getLPane().getComponentCount(); i++) {
            if (Iframe.getLPane().getComponent(i) instanceof LabelContext) {
                if (((MyIcon) (((LabelContext) Iframe.getLPane().getComponent(i)).getIcon())).getesc() > 0) {
                    ((MyIcon) (((LabelContext) Iframe.getLPane().getComponent(i)).getIcon())).UpEscale();
                    ((LabelContext) Iframe.getLPane().getComponent(i)).repaint();
                    ((LabelContext) Iframe.getLPane().getComponent(i)).setFont(new java.awt.Font("Tahoma", 0, 11 - (int) (11 - 11 * ((MyIcon) (((LabelContext) Iframe.getLPane().getComponent(i)).getIcon())).getesc())));
                    Iframe.getLPane().getComponent(i).setSize(90 - (int) (1.4 * (90 - 90 * ((MyIcon) (((LabelContext) Iframe.getLPane().getComponent(i)).getIcon())).getesc())), 90 - (int) (1.1 * (90 - 90 * ((MyIcon) (((LabelContext) Iframe.getLPane().getComponent(i)).getIcon())).getesc())));
                }
            }
        }
    }//GEN-LAST:event_btnZoomInActionPerformed
    public void GetSumarySemanticAnalizer(java.util.Hashtable messagesHashtable) {

        int sizeHashTable = messagesHashtable.size();

        // Variable para los mensajes del analizador semantico
        String mensaje = "";
        // Objeto del tipo Enumeration
        java.util.Enumeration enumeration;
        // Se enumeran las llaves de la tabla para recorrer esta en orden secuencial.
        enumeration = messagesHashtable.keys();
        for (int i = 0; i < sizeHashTable; i++) {         // Se puede usar hasMoreElements !!
            txtmsgSemantic.append((String) messagesHashtable.get(enumeration.nextElement()));
            txtmsgSemantic.append("\n");
        }
    }

    private void CrearNodo(javax.swing.tree.DefaultMutableTreeNode raiz) {
        javax.swing.tree.DefaultMutableTreeNode contexto = null;
        javax.swing.tree.DefaultMutableTreeNode objeto = null;
        javax.swing.tree.DefaultMutableTreeNode implicacion = null;
        javax.swing.tree.DefaultMutableTreeNode ItemImplicacion = null;
        javax.swing.tree.DefaultMutableTreeNode ItemImplicacion2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemImplicacion3 = null;

        contexto = new javax.swing.tree.DefaultMutableTreeNode("Context");
        raiz.add(contexto);
        objeto = new javax.swing.tree.DefaultMutableTreeNode("Objects");
        raiz.add(objeto);
        parentNode = raiz.getLastLeaf();
        implicacion = new javax.swing.tree.DefaultMutableTreeNode("Implications");
        raiz.add(implicacion);
        ItemImplicacion = new javax.swing.tree.DefaultMutableTreeNode("Ask");
        implicacion.add(ItemImplicacion);
        ItemImplicacion2 = new javax.swing.tree.DefaultMutableTreeNode("Tell");
        implicacion.add(ItemImplicacion2);
        ItemImplicacion3 = new javax.swing.tree.DefaultMutableTreeNode("MsgSend");
        implicacion.add(ItemImplicacion3);
    }

    private void CrearNodo2(javax.swing.tree.DefaultMutableTreeNode raiz2) {
        javax.swing.tree.DefaultMutableTreeNode proceso = null;
        javax.swing.tree.DefaultMutableTreeNode identificador = null;
        javax.swing.tree.DefaultMutableTreeNode objeto = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador1 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador3 = null;

        proceso = new javax.swing.tree.DefaultMutableTreeNode("Process");
        raiz2.add(proceso);
        identificador = new javax.swing.tree.DefaultMutableTreeNode("Identifiers");
        raiz2.add(identificador);
        objeto = new javax.swing.tree.DefaultMutableTreeNode("Objects");
        proceso.add(objeto);
        parentNode2 = proceso.getLastLeaf();
        ItemIdentificador2 = new javax.swing.tree.DefaultMutableTreeNode("Variable");
        identificador.add(ItemIdentificador2);


    }

    private void CrearNodo3(javax.swing.tree.DefaultMutableTreeNode raiz3) {
        javax.swing.tree.DefaultMutableTreeNode Restriccion_generica = null;
        Restriccion_generica = new javax.swing.tree.DefaultMutableTreeNode("Generic Restriction");
        raiz3.add(Restriccion_generica);
    }

    private void CrearNodo4(javax.swing.tree.DefaultMutableTreeNode raiz4) {
        javax.swing.tree.DefaultMutableTreeNode operadorMath = null;
        javax.swing.tree.DefaultMutableTreeNode operadorRel = null;
        javax.swing.tree.DefaultMutableTreeNode identificador = null;
        javax.swing.tree.DefaultMutableTreeNode ItemOperador1 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemOperador2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemOperador3 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemOperador4 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel1 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel3 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel4 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel5 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel6 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador1 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador3 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador4 = null;

        operadorMath = new javax.swing.tree.DefaultMutableTreeNode("Math Operators");
        raiz4.add(operadorMath);
        operadorRel = new javax.swing.tree.DefaultMutableTreeNode("Relational Operators");
        raiz4.add(operadorRel);
        identificador = new javax.swing.tree.DefaultMutableTreeNode("Identifiers");
        raiz4.add(identificador);
        ItemOperador1 = new javax.swing.tree.DefaultMutableTreeNode("Add");
        operadorMath.add(ItemOperador1);
        ItemOperador2 = new javax.swing.tree.DefaultMutableTreeNode("Substract");
        operadorMath.add(ItemOperador2);
        ItemOperador3 = new javax.swing.tree.DefaultMutableTreeNode("Multiply");
        operadorMath.add(ItemOperador3);
        ItemOperador4 = new javax.swing.tree.DefaultMutableTreeNode("Divide");
        operadorMath.add(ItemOperador4);
        ItemRel1 = new javax.swing.tree.DefaultMutableTreeNode("Equal");
        operadorRel.add(ItemRel1);
        ItemRel2 = new javax.swing.tree.DefaultMutableTreeNode("Greater");
        operadorRel.add(ItemRel2);
        ItemRel3 = new javax.swing.tree.DefaultMutableTreeNode("Greater Equal");
        operadorRel.add(ItemRel3);
        ItemRel4 = new javax.swing.tree.DefaultMutableTreeNode("Minor");
        operadorRel.add(ItemRel4);
        ItemRel5 = new javax.swing.tree.DefaultMutableTreeNode("Minor Equal");
        operadorRel.add(ItemRel5);
        ItemRel6 = new javax.swing.tree.DefaultMutableTreeNode("Distinct");
        operadorRel.add(ItemRel6);
        ItemIdentificador1 = new javax.swing.tree.DefaultMutableTreeNode("Value");
        identificador.add(ItemIdentificador1);
        ItemIdentificador2 = new javax.swing.tree.DefaultMutableTreeNode("Variable");
        identificador.add(ItemIdentificador2);
        ItemIdentificador3 = new javax.swing.tree.DefaultMutableTreeNode("Argument");
        identificador.add(ItemIdentificador3);
        ItemIdentificador4 = new javax.swing.tree.DefaultMutableTreeNode("Sender");
        identificador.add(ItemIdentificador4);
    }

    private void CrearNodo5(javax.swing.tree.DefaultMutableTreeNode raiz5) {
        javax.swing.tree.DefaultMutableTreeNode proceso = null;
        javax.swing.tree.DefaultMutableTreeNode objeto = null;
        javax.swing.tree.DefaultMutableTreeNode identificador = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador1 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador3 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador4 = null;

        proceso = new javax.swing.tree.DefaultMutableTreeNode("Process");
        raiz5.add(proceso);
        objeto = new javax.swing.tree.DefaultMutableTreeNode("Objects");
        proceso.add(objeto);
        parentNode5 = proceso.getLastLeaf();
        identificador = new javax.swing.tree.DefaultMutableTreeNode("Identifiers");
        raiz5.add(identificador);
        ItemIdentificador1 = new javax.swing.tree.DefaultMutableTreeNode("Value");
        identificador.add(ItemIdentificador1);
        ItemIdentificador2 = new javax.swing.tree.DefaultMutableTreeNode("Variable");
        identificador.add(ItemIdentificador2);
        ItemIdentificador3 = new javax.swing.tree.DefaultMutableTreeNode("Argument");
        identificador.add(ItemIdentificador3);
        ItemIdentificador4 = new javax.swing.tree.DefaultMutableTreeNode("Sender");
        identificador.add(ItemIdentificador4);
    }

    private void CrearNodo6(javax.swing.tree.DefaultMutableTreeNode raiz6) {
        javax.swing.tree.DefaultMutableTreeNode Restriccion_generica = null;
        Restriccion_generica = new javax.swing.tree.DefaultMutableTreeNode("Sender Restriction");
        raiz6.add(Restriccion_generica);
    }

    private void CrearNodo7(javax.swing.tree.DefaultMutableTreeNode raiz7) {
        javax.swing.tree.DefaultMutableTreeNode Restriccion_generica = null;
        Restriccion_generica = new javax.swing.tree.DefaultMutableTreeNode("Forward Restriction");
        raiz7.add(Restriccion_generica);
    }

    private void CrearNodo8(javax.swing.tree.DefaultMutableTreeNode raiz8) {
        javax.swing.tree.DefaultMutableTreeNode operadorMath = null;
        javax.swing.tree.DefaultMutableTreeNode operadorRel = null;
        javax.swing.tree.DefaultMutableTreeNode identificador = null;
        javax.swing.tree.DefaultMutableTreeNode ItemOperador1 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemOperador2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemOperador3 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemOperador4 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel1 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel3 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel4 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel5 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemRel6 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador1 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador2 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador3 = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador4 = null;

        operadorMath = new javax.swing.tree.DefaultMutableTreeNode("Math Operators");
        raiz8.add(operadorMath);
        operadorRel = new javax.swing.tree.DefaultMutableTreeNode("Relational Operators");
        raiz8.add(operadorRel);
        identificador = new javax.swing.tree.DefaultMutableTreeNode("Identifiers");
        raiz8.add(identificador);
        ItemOperador1 = new javax.swing.tree.DefaultMutableTreeNode("Add");
        operadorMath.add(ItemOperador1);
        ItemOperador2 = new javax.swing.tree.DefaultMutableTreeNode("Substract");
        operadorMath.add(ItemOperador2);
        ItemOperador3 = new javax.swing.tree.DefaultMutableTreeNode("Multiply");
        operadorMath.add(ItemOperador3);
        ItemOperador4 = new javax.swing.tree.DefaultMutableTreeNode("Divide");
        operadorMath.add(ItemOperador4);
        ItemRel1 = new javax.swing.tree.DefaultMutableTreeNode("Equal");
        operadorRel.add(ItemRel1);
        ItemRel2 = new javax.swing.tree.DefaultMutableTreeNode("Greater");
        operadorRel.add(ItemRel2);
        ItemRel3 = new javax.swing.tree.DefaultMutableTreeNode("Greater Equal");
        operadorRel.add(ItemRel3);
        ItemRel4 = new javax.swing.tree.DefaultMutableTreeNode("Minor");
        operadorRel.add(ItemRel4);
        ItemRel5 = new javax.swing.tree.DefaultMutableTreeNode("Minor Equal");
        operadorRel.add(ItemRel5);
        ItemRel6 = new javax.swing.tree.DefaultMutableTreeNode("Distinct");
        operadorRel.add(ItemRel6);
        ItemIdentificador1 = new javax.swing.tree.DefaultMutableTreeNode("Value");
        identificador.add(ItemIdentificador1);
        ItemIdentificador2 = new javax.swing.tree.DefaultMutableTreeNode("Variable");
        identificador.add(ItemIdentificador2);
        ItemIdentificador3 = new javax.swing.tree.DefaultMutableTreeNode("Argument");
        identificador.add(ItemIdentificador3);
        ItemIdentificador4 = new javax.swing.tree.DefaultMutableTreeNode("Forward");
        identificador.add(ItemIdentificador4);

    }

    private void CrearNodo9(javax.swing.tree.DefaultMutableTreeNode raiz9) {
        javax.swing.tree.DefaultMutableTreeNode proceso = null;
        javax.swing.tree.DefaultMutableTreeNode identificador = null;
        javax.swing.tree.DefaultMutableTreeNode ItemIdentificador1 = null;

        identificador = new javax.swing.tree.DefaultMutableTreeNode("Identifiers");
        raiz9.add(identificador);

        ItemIdentificador1 = new javax.swing.tree.DefaultMutableTreeNode("Argument");
        identificador.add(ItemIdentificador1);
    }
    // Esta es la clase que va a permitir personalizar la presentaci�n
    // de cada una de las ramas del �rbol

    public class MirendererTree extends JLabel implements javax.swing.tree.TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto2, Iobjeto3, Iobjeto4, Iobjeto5, Iobjeto6, Iobjeto7;
        private javax.swing.ImageIcon Iobjeto8;
        private boolean seleccionado;

        public MirendererTree() {
            //cargamos las imagenes 
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folderP.gif"));
            Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/context.gif"));
            Iobjeto3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/profile.gif"));
            Iobjeto4 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto5 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/ask.gif"));
            Iobjeto6 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/tell.gif"));
            Iobjeto7 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/msgSend.gif"));
            Iobjeto8 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/bjt.gif"));
        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la imagen de la carta que corresponde a esa celda
            if (texto.equals("Process")) {
                setIcon(Iobjeto4);
            } else if (texto.equals("Context")) {
                setIcon(Iobjeto2);
            } else if (texto.equals("Objects")) {
                setIcon(Iobjeto4);
            } else if (texto.equals("Implications")) {
                setIcon(Iobjeto4);
            } else if (texto.equals("Ask")) {
                setIcon(Iobjeto5);
            } else if (texto.equals("Tell")) {
                setIcon(Iobjeto6);
            } else if (texto.equals("MsgSend")) {
                setIcon(Iobjeto7);
            } else if (esObjeto(texto)) {
                setIcon(Iobjeto8);
            }
            // A continuaci�n del icono, ponemos el texto
            setText(texto);
            return (this);
        }

        public void paint(java.awt.Graphics g) {
            // Sobreescribimos el m�todo paint() para fijar el color de
            // fondo. Normalmente, un JLabel puede pintar su propio fondo,
            // pero, seguramente debido aparentemente a un bug, o a una
            // limitaci�n en el TreeCellRenderer, es necesario recurrir
            // al m�todo paint() para hacer esto

            java.awt.Color color;
            Icon currentI = getIcon();
            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }
    //Esta clase permite personalizar el arbol2

    public class MirendererTree2 extends JLabel implements TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto3, Iobjeto11, Iobjeto13, Iobjeto14;
        private boolean seleccionado;

        public MirendererTree2() {
            //cargamos las imagenes
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/program.gif"));
            Iobjeto3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto11 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/variable.gif"));
            Iobjeto13 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/bjt.gif"));
            Iobjeto14 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/method.gif"));
        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la imagen de la carta que corresponde a esa celda
            if (texto.equals("Program")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Process")) {
                setIcon(Iobjeto3);
            } else if (texto.equals("Identifiers")) {
                setIcon(Iobjeto3);
            } else if (texto.equals("Objects")) {
                setIcon(Iobjeto3);
            } else if (texto.equals("Variable")) {
                setIcon(Iobjeto11);
            } else if (esObjeto(texto)) {
                setIcon(Iobjeto13);
            } else if (esMetodo(texto)) {
                setIcon(Iobjeto14);
                int k;
                for (k = 0; k < texto.length(); k++) {
                    if (texto.charAt(k) == '.') {
                        break;
                    }
                }
                texto = texto.substring(k + 1);
            }
            // A continuaci�n del icono, ponemos el texto
            setText(texto);
            return (this);
        }

        public void paint(java.awt.Graphics g) {
            // Sobreescribimos el m�todo paint() para fijar el color de
            // fondo. Normalmente, un JLabel puede pintar su propio fondo,
            // pero, seguramente debido aparentemente a un bug, o a una
            // limitaci�n en el TreeCellRenderer, es necesario recurrir
            // al m�todo paint() para hacer esto

            java.awt.Color color;
            Icon currentI = getIcon();

            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }
    //esta clase me prmite personalizar el arbol3

    public class MirendererTree3 extends JLabel implements TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto2;
        private boolean seleccionado;

        public MirendererTree3() {
            //cargamos las imagenes 
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/genericRestriction.gif"));
        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la imagen de la carta que corresponde a esa celda
            if (texto.equals("Restrictions")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Generic Restriction")) {
                setIcon(Iobjeto2);
            }
            // A continuaci�n del icono, ponemos el texto
            setText(texto);

            return (this);
        }

        public void paint(java.awt.Graphics g) {

            java.awt.Color color;
            Icon currentI = getIcon();
            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }

    public class MirendererTree4 extends JLabel implements TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto2, Iobjeto3, Iobjeto4, Iobjeto5, Iobjeto6, Iobjeto7;
        private javax.swing.ImageIcon Iobjeto8, Iobjeto9, Iobjeto10, Iobjeto11, Iobjeto12, Iobjeto13, Iobjeto14, Iobjeto15;
        private boolean seleccionado;

        public MirendererTree4() {
            //cargamos las imagenes
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/add.gif"));
            Iobjeto3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/substract.gif"));
            Iobjeto4 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/multiply.gif"));
            Iobjeto5 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/divide.gif"));
            Iobjeto6 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/equal.gif"));
            Iobjeto7 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/greater.gif"));
            Iobjeto8 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/greaterEqual.gif"));
            Iobjeto9 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/minor.gif"));
            Iobjeto10 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/minorEqual.gif"));
            Iobjeto11 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/distinct.gif"));
            Iobjeto12 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/value.gif"));
            Iobjeto13 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/variable.gif"));
            Iobjeto14 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/argument.gif"));
            Iobjeto15 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/senderOperator.gif"));

        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la ../imagen de la carta que corresponde a esa celda
            if (texto.equals("Operators")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Math Operators")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Relational Operators")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Identifiers")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Add")) {
                setIcon(Iobjeto2);
            } else if (texto.equals("Substract")) {
                setIcon(Iobjeto3);
            } else if (texto.equals("Multiply")) {
                setIcon(Iobjeto4);
            } else if (texto.equals("Divide")) {
                setIcon(Iobjeto5);
            } else if (texto.equals("Equal")) {
                setIcon(Iobjeto6);
            } else if (texto.equals("Greater")) {
                setIcon(Iobjeto7);
            } else if (texto.equals("Greater Equal")) {
                setIcon(Iobjeto8);
            } else if (texto.equals("Minor")) {
                setIcon(Iobjeto9);
            } else if (texto.equals("Minor Equal")) {
                setIcon(Iobjeto10);
            } else if (texto.equals("Distinct")) {
                setIcon(Iobjeto11);
            } else if (texto.equals("Value")) {
                setIcon(Iobjeto12);
            } else if (texto.equals("Variable")) {
                setIcon(Iobjeto13);
            } else if (texto.equals("Argument")) {
                setIcon(Iobjeto14);
            } else if (texto.equals("Sender")) {
                setIcon(Iobjeto15);
            }
            // A continuaci�n del icono, ponemos el texto 
            setText(texto);

            return (this);


        }

        public void paint(java.awt.Graphics g) {
            // Sobreescribimos el m�todo paint() para fijar el color de
            // fondo. Normalmente, un JLabel puede pintar su propio fondo,
            // pero, seguramente debido aparentemente a un bug, o a una
            // limitaci�n en el TreeCellRenderer, es necesario recurrir
            // al m�todo paint() para hacer esto

            java.awt.Color color;
            Icon currentI = getIcon();

            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }

    public class MirendererTree5 extends JLabel implements TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto2, Iobjeto3, Iobjeto4, Iobjeto5, Iobjeto6, Iobjeto7, Iobjeto8, Iobjeto9;
        private boolean seleccionado;

        public MirendererTree5() {
            //cargamos las imagen 
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto4 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/value.gif"));
            Iobjeto5 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/variable.gif"));
            Iobjeto6 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/argument.gif"));
            Iobjeto7 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/senderOperator.gif"));
            Iobjeto8 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/bjt.gif"));
            Iobjeto9 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/method.gif"));
        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la ../imagen de la carta que corresponde a esa celda
            if (texto.equals("Message")) {
                setIcon(Iobjeto2);
            } else if (texto.equals("Process")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Objects")) {
                setIcon(Iobjeto2);
            } else if (texto.equals("Identifiers")) {
                setIcon(Iobjeto3);
            } else if (texto.equals("Value")) {
                setIcon(Iobjeto4);
            } else if (texto.equals("Variable")) {
                setIcon(Iobjeto5);
            } else if (texto.equals("Argument")) {
                setIcon(Iobjeto6);
            } else if (texto.equals("Sender")) {
                setIcon(Iobjeto7);
            } else if (esObjeto(texto)) {
                setIcon(Iobjeto8);
            } else if (esMetodo(texto)) {
                setIcon(Iobjeto9);
                int k;
                for (k = 0; k < texto.length(); k++) {
                    if (texto.charAt(k) == '.') {
                        break;
                    }
                }
                texto = texto.substring(k + 1);
            }
            // A continuaci�n del icono, ponemos el texto
            setText(texto);

            return (this);


        }

        public void paint(java.awt.Graphics g) {
            // Sobreescribimos el m�todo paint() para fijar el color de
            // fondo. Normalmente, un JLabel puede pintar su propio fondo,
            // pero, seguramente debido aparentemente a un bug, o a una
            // limitaci�n en el TreeCellRenderer, es necesario recurrir
            // al m�todo paint() para hacer esto

            java.awt.Color color;
            Icon currentI = getIcon();

            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }

    public class MirendererTree6 extends JLabel implements TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto2;
        private boolean seleccionado;

        public MirendererTree6() {
            //cargamos las imagen 
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/senderRestriction.gif"));
        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la ../imagen de la carta que corresponde a esa celda
            if (texto.equals("Restrictions")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Sender Restriction")) {
                setIcon(Iobjeto2);
            }
            // A continuaci�n del icono, ponemos el texto
            setText(texto);

            return (this);
        }

        public void paint(java.awt.Graphics g) {

            java.awt.Color color;
            Icon currentI = getIcon();
            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }

    public class MirendererTree7 extends JLabel implements TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto2;
        private boolean seleccionado;

        public MirendererTree7() {
            //cargamos las imagen 
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/forwardRestriction.gif"));
        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la ../imagen de la carta que corresponde a esa celda
            if (texto.equals("Restrictions")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Forward Restriction")) {
                setIcon(Iobjeto2);
            }
            // A continuaci�n del icono, ponemos el texto
            setText(texto);

            return (this);
        }

        public void paint(java.awt.Graphics g) {

            java.awt.Color color;
            Icon currentI = getIcon();
            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }

    public class MirendererTree8 extends JLabel implements TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto2, Iobjeto3, Iobjeto4, Iobjeto5, Iobjeto6, Iobjeto7;
        private javax.swing.ImageIcon Iobjeto8, Iobjeto9, Iobjeto10, Iobjeto11, Iobjeto12, Iobjeto13, Iobjeto14, Iobjeto15;
        private boolean seleccionado;

        public MirendererTree8() {
            //cargamos las imagenes
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/add.gif"));
            Iobjeto3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/substract.gif"));
            Iobjeto4 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/multiply.gif"));
            Iobjeto5 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/divide.gif"));
            Iobjeto6 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/equal.gif"));
            Iobjeto7 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/greater.gif"));
            Iobjeto8 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/greaterEqual.gif"));
            Iobjeto9 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/minor.gif"));
            Iobjeto10 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/minorEqual.gif"));
            Iobjeto11 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/distinct.gif"));
            Iobjeto12 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/value.gif"));
            Iobjeto13 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/variable.gif"));
            Iobjeto14 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/argument.gif"));
            Iobjeto15 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/forwardOperator.gif"));

        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la ../imagen de la carta que corresponde a esa celda
            if (texto.equals("Operators")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Math Operators")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Relational Operators")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Identifiers")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Add")) {
                setIcon(Iobjeto2);
            } else if (texto.equals("Substract")) {
                setIcon(Iobjeto3);
            } else if (texto.equals("Multiply")) {
                setIcon(Iobjeto4);
            } else if (texto.equals("Divide")) {
                setIcon(Iobjeto5);
            } else if (texto.equals("Equal")) {
                setIcon(Iobjeto6);
            } else if (texto.equals("Greater")) {
                setIcon(Iobjeto7);
            } else if (texto.equals("Greater Equal")) {
                setIcon(Iobjeto8);
            } else if (texto.equals("Minor")) {
                setIcon(Iobjeto9);
            } else if (texto.equals("Minor Equal")) {
                setIcon(Iobjeto10);
            } else if (texto.equals("Distinct")) {
                setIcon(Iobjeto11);
            } else if (texto.equals("Value")) {
                setIcon(Iobjeto12);
            } else if (texto.equals("Variable")) {
                setIcon(Iobjeto13);
            } else if (texto.equals("Argument")) {
                setIcon(Iobjeto14);
            } else if (texto.equals("Forward")) {
                setIcon(Iobjeto15);
            }
            // A continuaci�n del icono, ponemos el texto 
            setText(texto);

            return (this);


        }

        public void paint(java.awt.Graphics g) {
            // Sobreescribimos el m�todo paint() para fijar el color de
            // fondo. Normalmente, un JLabel puede pintar su propio fondo,
            // pero, seguramente debido aparentemente a un bug, o a una
            // limitaci�n en el TreeCellRenderer, es necesario recurrir
            // al m�todo paint() para hacer esto

            java.awt.Color color;
            Icon currentI = getIcon();

            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }
    //rendel del arbol 9

    public class MirendererTree9 extends JLabel implements TreeCellRenderer {

        private javax.swing.ImageIcon Iobjeto1, Iobjeto2, Iobjeto3, Iobjeto4, Iobjeto5, Iobjeto6, Iobjeto7, Iobjeto8, Iobjeto9, Iobjeto12, Iobjeto13;
        private boolean seleccionado;

        public MirendererTree9() {
            //cargamos las imagenes
            Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/program.gif"));
            Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folderP.gif"));
            Iobjeto3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto4 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/context.gif"));
            Iobjeto5 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/profile.gif"));
            Iobjeto6 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/folder.gif"));
            Iobjeto7 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/ask.gif"));
            Iobjeto8 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/tell.gif"));
            Iobjeto9 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/msgSend.gif"));
            Iobjeto12 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/argument.gif"));
            Iobjeto13 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/bjt.gif"));

        }

        public java.awt.Component getTreeCellRendererComponent(JTree arbol, Object valor, boolean seleccionado, boolean expandido, boolean rama, int fila, boolean conFoco) {
            // Hay que encontrar el nodo en que estamos y coger el
            // texto que contiene
            DefaultMutableTreeNode nodo = (DefaultMutableTreeNode) valor;
            String texto = (String) nodo.getUserObject();
            this.seleccionado = seleccionado;
            // Se fija el color de fondo en funci�n de que est� o no 
            // seleccionada la celda del �rbol
            if (!seleccionado) {
                setForeground(java.awt.Color.black);
            } else {
                setForeground(java.awt.Color.white);
            }
            // Fijamos el icono que corresponde al texto de la celda, para
            // presentar la ../imagen de la carta que corresponde a esa celda
            if (texto.equals("Program")) {
                setIcon(Iobjeto1);
            } else if (texto.equals("Identifiers")) {
                setIcon(Iobjeto3);
            } else if (texto.equals("Argument")) {
                setIcon(Iobjeto12);
            }
            // A continuaci�n del icono, ponemos el texto
            setText(texto);
            return (this);
        }

        public void paint(java.awt.Graphics g) {
            // Sobreescribimos el m�todo paint() para fijar el color de
            // fondo. Normalmente, un JLabel puede pintar su propio fondo,
            // pero, seguramente debido aparentemente a un bug, o a una
            // limitaci�n en el TreeCellRenderer, es necesario recurrir
            // al m�todo paint() para hacer esto

            java.awt.Color color;
            Icon currentI = getIcon();

            // Fijamos el colos de fondo
            color = seleccionado ? java.awt.Color.GRAY : java.awt.Color.white;
            g.setColor(color);
            // Rellenamos el rect�ngulo que ocupa el texto sobre la
            // celda del �rbol
            g.fillRect(0, 0, getWidth() - 1, getHeight() - 1);
            super.paint(g);
        }
    }
    //***********************************  

    public static void addElementtoDesKtop(JInternalFrame elemento) {
        jdpAreaTrabajo.add(elemento);
    }

    public static java.awt.Component getInternalFrame(String id) {
        javax.swing.JInternalFrame[] j = jdpAreaTrabajo.getAllFrames();
        for (int i = 0; i < j.length; i++) {
            if (j[i].getTitle().equals(id)) {
                return j[i];
            }
        }
        return null;
    }

    public static boolean esObjeto(String id) {
        boolean a = false;
        for (int i = 0; i < objetos.size(); i++) {
            if (((ObjectAtList) objetos.get(i)).getID().equals(id)) {
                a = true;
            }
        }
        return a;
    }

    public static boolean esMetodo(String id) {
        boolean a = false;
        for (int i = 0; i < metodos.size(); i++) {
            if (((String) metodos.get(i)).equals(id)) {
                a = true;
            }
        }
        return a;
    }

    public static void AddObjeto(ObjectAtList id) {
        objetos.add(id);
    }

    public static ObjectAtList getObjeto(String id) {
        for (int i = 0; i < objetos.size(); i++) {
            if (((ObjectAtList) objetos.get(i)).getID().equals(id)) {
                return (ObjectAtList) objetos.get(i);
            } else {
                continue;
            }
        }
        return null;
    }

    public static MethodList getMethod(String id) {
        for (int i = 0; i < objetos.size(); i++) {
            for (int j = 0; j < ((ObjectAtList) objetos.get(i)).getMethodCount(); j++) {
                if (((ObjectAtList) objetos.get(i)).getMethod(j).getID().equals(id)) {
                    return ((ObjectAtList) objetos.get(i)).getMethod(j);
                } else {
                    continue;
                }
            }
        }
        return null;
    }

    public static void AddMethod(String id) {
        metodos.add(id);
    }

    public static void setComment(String s) {
        lblContexto.setText(s);
    }

    public static String getSelectionNodeParent2() {
        return ((javax.swing.tree.DefaultMutableTreeNode) jTree2.getLastSelectedPathComponent()).getParent().toString();
    }

    /**Propociona el icono en el frame
     * 
     * @return retValue image
     */
    @Override
    public Image getIconImage() {
        Image retValue = Toolkit.getDefaultToolkit().
                getImage(ClassLoader.getSystemResource("co/edu/usbcali/egrapico/images/logoepico.gif"));
        return retValue;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {

        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                //new FrmPrincipal().setVisible(true);
                FrmPrincipal main = new FrmPrincipal();
                main.setExtendedState(MAXIMIZED_BOTH);
                main.setVisible(true);
            }
        });
    }
    private static ObjectAtList obj;
    private static javax.swing.tree.DefaultMutableTreeNode parentNode;
    private static javax.swing.tree.DefaultMutableTreeNode parentNode2;
    private static javax.swing.tree.DefaultMutableTreeNode parentNode5;
    private static javax.swing.tree.DefaultMutableTreeNode parentNode9;
    private static javax.swing.tree.DefaultTreeModel treeModel;
    private static javax.swing.tree.DefaultTreeModel treeModel2;
    private static javax.swing.tree.DefaultTreeModel treeModel5;
    private static javax.swing.tree.DefaultTreeModel treeModel9;
    private java.awt.Dimension area;
    private javax.swing.tree.DefaultMutableTreeNode raiz;
    private javax.swing.tree.DefaultMutableTreeNode raiz2;
    private javax.swing.tree.DefaultMutableTreeNode raiz3;
    private javax.swing.tree.DefaultMutableTreeNode raiz4;
    private javax.swing.tree.DefaultMutableTreeNode raiz5;
    private javax.swing.tree.DefaultMutableTreeNode raiz6;
    private javax.swing.tree.DefaultMutableTreeNode raiz7;
    private javax.swing.tree.DefaultMutableTreeNode raiz8;
    private javax.swing.tree.DefaultMutableTreeNode raiz9;
    private PanelProgram Iframe;
    private javax.swing.JScrollPane jScrollPane2;
    private static java.util.Vector objetos;
    private static java.util.Vector metodos;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JFileChooser Save_File;
    private javax.swing.JMenuItem ambient_aligntogrid;
    private javax.swing.JMenuItem ambient_ambientlist;
    private javax.swing.JMenuItem ambient_gotomain;
    private javax.swing.JMenuItem ambient_gridmas;
    private javax.swing.JMenuItem ambient_gridmen;
    private javax.swing.JMenuItem ambient_showgrid;
    private javax.swing.JMenuItem ambient_zoomin;
    private javax.swing.JMenuItem ambient_zoomout;
    private javax.swing.JButton btnAmbient;
    private javax.swing.JButton btnCompile;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnGrid;
    private javax.swing.JButton btnGridIn;
    private javax.swing.JButton btnGridOut;
    private javax.swing.JButton btnHome;
    private javax.swing.JButton btnNew;
    private javax.swing.JButton btnOpen;
    private javax.swing.JButton btnParse;
    private javax.swing.JButton btnPrint;
    private javax.swing.JButton btnPropierties;
    private javax.swing.JButton btnRedo;
    private javax.swing.JButton btnSave;
    private javax.swing.JButton btnShell;
    private javax.swing.JButton btnTools;
    private javax.swing.JButton btnUndo;
    private javax.swing.JButton btnView;
    private javax.swing.JButton btnZoomIn;
    private javax.swing.JButton btnZoomOut;
    private javax.swing.JMenuItem build_compile;
    private javax.swing.JMenuItem build_parse;
    private javax.swing.JMenuItem file_exit;
    private javax.swing.JMenuItem file_new;
    private javax.swing.JMenuItem file_open;
    private javax.swing.JMenuItem file_print;
    private javax.swing.JMenuItem file_printpreview;
    private javax.swing.JMenuItem file_save;
    private javax.swing.JMenuItem file_save_as;
    private javax.swing.JSeparator file_separador1;
    private javax.swing.JSeparator file_separador2;
    private javax.swing.JFrame form3;
    private javax.swing.JMenuItem help_about;
    private javax.swing.JMenuItem help_grapico;
    private javax.swing.JMenuBar jBarraMenu;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JPopupMenu jPopupMenu1;
    private javax.swing.JPopupMenu jPopupMenu2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JSplitPane jSplitPane2;
    private static javax.swing.JTree jTree1;
    private static javax.swing.JTree jTree2;
    private javax.swing.JTree jTree3;
    private javax.swing.JTree jTree4;
    private static javax.swing.JTree jTree5;
    private javax.swing.JTree jTree6;
    private javax.swing.JTree jTree7;
    private javax.swing.JTree jTree8;
    private static javax.swing.JTree jTree9;
    private static javax.swing.JDesktopPane jdpAreaTrabajo;
    private javax.swing.JPanel jpContenedor;
    private javax.swing.JScrollPane jspAnalisisSemantico;
    private javax.swing.JScrollPane jspCalculoPico;
    private javax.swing.JScrollPane jspGrapitextual;
    private javax.swing.JScrollPane jspResultados;
    private javax.swing.JToolBar jtBarraEdit;
    private javax.swing.JToolBar jtBarraFile;
    private javax.swing.JToolBar jtBarraPpal;
    private javax.swing.JToolBar jtBarraPrint;
    private javax.swing.JToolBar jtBarraRun;
    private javax.swing.JToolBar jtBarraView;
    private javax.swing.JTabbedPane jtpPestanas;
    private static javax.swing.JLabel lblContexto;
    private javax.swing.JMenu mambient;
    private javax.swing.JMenu mbuild;
    private javax.swing.JMenu mfile;
    private javax.swing.JMenu mhelp;
    private javax.swing.JMenu mobject;
    private javax.swing.JMenu mwindow;
    private javax.swing.JMenuItem object_shape;
    private javax.swing.JMenuItem objetc_remove;
    private javax.swing.JTextArea txtFileGraPicoT;
    private javax.swing.JTextArea txtTraslatePico;
    private javax.swing.JTextArea txtmsgResults;
    private javax.swing.JTextArea txtmsgSemantic;
    private javax.swing.JMenuItem window_cascade;
    private javax.swing.JMenuItem window_hidetoolbox;
    private javax.swing.JMenuItem window_main;
    private javax.swing.JMenuItem window_tileh;
    private javax.swing.JMenuItem window_tilev;
    // End of variables declaration//GEN-END:variables

    class MyDesktopManager extends DefaultDesktopManager {

        protected int[] m_counts = new int[15];

        public void clearCounts() {
            for (int i = 0; i < 15; i++) {
                m_counts[i] = 0;
            }
        }

        public int[] getCounts() {
            return m_counts;
        }

        public void activateFrame(JInternalFrame f) {
            super.activateFrame(f);
            String s1 = "";
            String s = f.getTitle();
            for (int i = s.length() - 1; i >= 0; i--) {
                if (s.charAt(i) == '.') {
                    break;
                }
                s1 = s.charAt(i) + s1;
            }
            if (f instanceof PanelProgram) {
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree1);
            } else if (f instanceof PanelContext) {//if(s1.startsWith("Contexto")){
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree2);
            } else if (f instanceof PanelPrecedent) {//if(s1.startsWith("Precedent")){ //Restriccion
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree3);
            } else if (f instanceof PanelPrecedentMsg) {
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree5);
            } else if (f instanceof PanelRestriction) {//if(s1.startsWith("Restricci")){ 
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree4);
            } else if (f instanceof PanelPrecedentSender) {
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree6);
            } else if (f instanceof PanelPrecedentForward) {
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree7);
            } else if (f instanceof PanelRestrictionF) {
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree8);
            } else if (f instanceof PanelMethod) {
                lblContexto.setText(s1);
                jScrollPane1.setViewportView(jTree9);
            }
            btnUndo.setEnabled(true);
            btnRedo.setEnabled(true);
            m_counts[0]++;
        }

        public void beginDraggingFrame(JComponent f) {
            m_counts[1]++;
        }

        public void beginResizingFrame(JComponent f, int direction) {
            m_counts[2]++;
        }

        public void closeFrame(JInternalFrame f) {
            super.closeFrame(f);
            m_counts[3]++;
        }

        public void deactivateFrame(JInternalFrame f) {
            super.deactivateFrame(f);
            m_counts[4]++;
        }

        public void deiconifyFrame(JInternalFrame f) {
            super.deiconifyFrame(f);
            m_counts[5]++;
        }

        public void dragFrame(JComponent f, int newX, int newY) {
            if (newX < 0) {
                f.setLocation(0, newY);
            } else if (newY < 0) {
                f.setLocation(newX, 0);
            } else {
                f.setLocation(newX, newY);
                final int W = 100;
                final int H = 100;
                boolean changed = false;

                int x = newX - W / 2;
                int y = newY - H / 2;
                if (x < 0) {
                    x = 0;
                }
                if (y < 0) {
                    y = 0;
                }
                java.awt.Rectangle rect = new java.awt.Rectangle(x, y, W, H);
                jdpAreaTrabajo.scrollRectToVisible(rect);

                int this_width = (x + W + 2);
                if (this_width > area.width) {
                    area.width = this_width;
                    changed = true;
                }

                int this_height = (y + H + 2);
                if (this_height > area.height) {
                    area.height = this_height;
                    changed = true;
                }

                jdpAreaTrabajo.setPreferredSize(area);
                //Let the scroll pane know to update itself
                //and its scrollbars.
                jdpAreaTrabajo.revalidate();
            }
            m_counts[6]++;
        }

        public void endDraggingFrame(JComponent f) {
            m_counts[7]++;
        }

        public void endResizingFrame(JComponent f) {
            m_counts[8]++;
        }

        public void iconifyFrame(JInternalFrame f) {
            super.iconifyFrame(f);
            m_counts[9]++;
        }

        public void maximizeFrame(JInternalFrame f) {
            super.maximizeFrame(f);
            m_counts[10]++;
        }

        public void minimizeFrame(JInternalFrame f) {
            super.minimizeFrame(f);
            m_counts[11]++;
        }

        public void openFrame(JInternalFrame f) {
            m_counts[12]++;
        }

        public void resizeFrame(JComponent f,
                int newX, int newY, int newWidth, int newHeight) {
            f.setBounds(newX, newY, newWidth, newHeight);
            m_counts[13]++;
        }

        public void setBoundsForFrame(JComponent f,
                int newX, int newY, int newWidth, int newHeight) {
            f.setBounds(newX, newY, newWidth, newHeight);
            m_counts[14]++;
        }
    }
}
